Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ophélie Gagnard
slapos.core
Commits
ecc0d024
Commit
ecc0d024
authored
Sep 15, 2020
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: stop using old assert methods
parent
c304e5bf
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
103 additions
and
103 deletions
+103
-103
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
...ortal_components/test.erp5.testSlapOSAccountingBuilder.py
+1
-1
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
...omponents/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
+2
-2
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
...ents/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
+10
-10
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
...ateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
+6
-6
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
...components/test.erp5.testSlapOSERP5InteractionWorkflow.py
+41
-41
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
...ortal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
+27
-27
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
...ateItem/portal_components/test.erp5.testSlapOSSlapTool.py
+3
-3
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
...al_components/test.erp5.testSlapOSSubscriptionScenario.py
+5
-5
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
...ct/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
+2
-2
slapos/tests/test_cli.py
slapos/tests/test_cli.py
+6
-6
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingBuilder.py
View file @
ecc0d024
...
@@ -1336,7 +1336,7 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
...
@@ -1336,7 +1336,7 @@ class TestSlapOSAggregatedDeliveryBuilder(SlapOSTestCaseMixin):
built_update_line
.
getResource
())
built_update_line
.
getResource
())
self
.
assertEqual
(
1.0
,
built_subscription_line
.
getQuantity
())
self
.
assertEqual
(
1.0
,
built_subscription_line
.
getQuantity
())
self
.
assertAlmostEqual
s
(
0.0
,
built_subscription_line
.
getPrice
(),
3
)
self
.
assertAlmostEqual
(
0.0
,
built_subscription_line
.
getPrice
(),
3
)
self
.
assertEqual
(
subscription_line
.
getResource
(),
self
.
assertEqual
(
subscription_line
.
getResource
(),
built_subscription_line
.
getResource
())
built_subscription_line
.
getResource
())
...
...
master/bt5/slapos_cloud/TestTemplateItem/portal_components/test.erp5.SlapOSTestCaseDefaultScenarioMixin.py
View file @
ecc0d024
...
@@ -661,7 +661,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -661,7 +661,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
portal_type
=
"Person"
,
portal_type
=
"Person"
,
user_id
=
user_id
)
user_id
=
user_id
)
self
.
assertNotEqual
s
(
person
,
None
)
self
.
assertNotEqual
(
person
,
None
)
# User received an email for payment
# User received an email for payment
email
=
person
.
getDefaultEmailText
()
email
=
person
.
getDefaultEmailText
()
...
@@ -694,7 +694,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
...
@@ -694,7 +694,7 @@ class DefaultScenarioMixin(TestSlapOSSecurityMixin):
portal_type
=
"Person"
,
portal_type
=
"Person"
,
user_id
=
user_id
)
user_id
=
user_id
)
self
.
assertNotEqual
s
(
person
,
None
)
self
.
assertNotEqual
(
person
,
None
)
# User received an email for payment
# User received an email for payment
email
=
person
.
getDefaultEmailText
()
email
=
person
.
getDefaultEmailText
()
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMRegularisationRequestSkins.py
View file @
ecc0d024
...
@@ -147,8 +147,8 @@ The slapos team
...
@@ -147,8 +147,8 @@ The slapos team
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket
,
event
=
person
.
Person_checkToCreateRegularisationRequest
()
transaction
.
commit
()
transaction
.
commit
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
ticket2
,
None
)
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -169,8 +169,8 @@ The slapos team
...
@@ -169,8 +169,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -182,8 +182,8 @@ The slapos team
...
@@ -182,8 +182,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
s
(
ticket
,
None
)
self
.
assertNotEqual
(
ticket
,
None
)
self
.
assertNotEqual
s
(
event
,
None
)
self
.
assertNotEqual
(
event
,
None
)
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
...
@@ -195,8 +195,8 @@ The slapos team
...
@@ -195,8 +195,8 @@ The slapos team
transaction
.
commit
()
transaction
.
commit
()
self
.
tic
()
self
.
tic
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
ticket2
,
event2
=
person
.
Person_checkToCreateRegularisationRequest
()
self
.
assertNotEqual
s
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertNotEqual
(
ticket2
.
getRelativeUrl
(),
ticket
.
getRelativeUrl
())
self
.
assertNotEqual
s
(
event2
,
None
)
self
.
assertNotEqual
(
event2
,
None
)
def
test_addRegularisationRequest_REQUEST_disallowed
(
self
):
def
test_addRegularisationRequest_REQUEST_disallowed
(
self
):
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
person
=
self
.
makePerson
(
index
=
0
,
user
=
0
)
...
@@ -347,7 +347,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
...
@@ -347,7 +347,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
self
.
assertEqual
(
ticket
.
getResource
(),
'foo/bar'
)
self
.
assertEqual
(
ticket
.
getResource
(),
'foo/bar'
)
self
.
assertNotEqual
s
(
event
.
getTitle
(),
'foo2 title'
)
self
.
assertNotEqual
(
event
.
getTitle
(),
'foo2 title'
)
self
.
assertEqual
(
event
.
getTextContent
(),
None
)
self
.
assertEqual
(
event
.
getTextContent
(),
None
)
self
.
assertEqual
(
event
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
event
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getRelativeUrl
(),
event2
.
getRelativeUrl
())
...
@@ -379,7 +379,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
...
@@ -379,7 +379,7 @@ class TestSlapOSRegularisationRequest_checkToSendUniqEvent(SlapOSTestCaseMixin):
transaction
.
commit
()
transaction
.
commit
()
event2
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
event2
=
ticket
.
RegularisationRequest_checkToSendUniqEvent
(
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
'service_module/slapos_crm_spam'
,
'foo2 title'
,
'foo2 content'
,
'foo2 comment'
)
self
.
assertNotEqual
s
(
event
,
event2
)
self
.
assertNotEqual
(
event
,
event2
)
self
.
assertEqual
(
event2
,
None
)
self
.
assertEqual
(
event2
,
None
)
def
test_checkToSendUniqEvent_REQUEST_disallowed
(
self
):
def
test_checkToSendUniqEvent_REQUEST_disallowed
(
self
):
...
...
master/bt5/slapos_crm/TestTemplateItem/portal_components/test.erp5.testSlapOSCRMSkins.py
View file @
ecc0d024
...
@@ -107,7 +107,7 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
...
@@ -107,7 +107,7 @@ class TestSlapOSSupportRequestModule_getMonitoringUrlList(TestCRMSkinsMixin):
module
=
self
.
portal
.
support_request_module
module
=
self
.
portal
.
support_request_module
# We assume here that several objects created by others tests don't influentiate
# We assume here that several objects created by others tests don't influentiate
# this test.
# this test.
self
.
assertEqual
s
(
module
.
SupportRequestModule_getMonitoringUrlList
(),
[])
self
.
assertEqual
(
module
.
SupportRequestModule_getMonitoringUrlList
(),
[])
hosting_subscription
=
self
.
_makeHostingSubscription
()
hosting_subscription
=
self
.
_makeHostingSubscription
()
self
.
_makeSoftwareInstance
(
hosting_subscription
,
"https://xxx/"
)
self
.
_makeSoftwareInstance
(
hosting_subscription
,
"https://xxx/"
)
support_request
=
module
.
newContent
(
portal_type
=
"Support Request"
)
support_request
=
module
.
newContent
(
portal_type
=
"Support Request"
)
...
@@ -669,7 +669,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
...
@@ -669,7 +669,7 @@ class TestSlapOSComputer_notifyWrongAllocationScope(TestCRMSkinsMixin):
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/personal'
)
self
.
assertEqual
(
computer
.
getAllocationScope
(),
'open/personal'
)
#ticket = self._getGeneratedSupportRequest(computer)
#ticket = self._getGeneratedSupportRequest(computer)
self
.
assertNotEqual
s
(
None
,
ticket
)
self
.
assertNotEqual
(
None
,
ticket
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
ticket
.
getSimulationState
(),
'suspended'
)
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
self
.
assertEqual
(
'Visited by SupportRequest_trySendNotificationMessage '
\
...
@@ -1800,7 +1800,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -1800,7 +1800,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
first_event
.
getTitle
())
self
.
assertEqual
(
title
,
first_event
.
getTitle
())
self
.
assertEqual
(
text_content
,
first_event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
first_event
.
getTextContent
())
self
.
assertNotEqual
s
(
None
,
first_event
.
getStartDate
())
self
.
assertNotEqual
(
None
,
first_event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
first_event
.
getResource
())
first_event
.
getResource
())
self
.
assertEqual
(
first_event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
first_event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -1814,7 +1814,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -1814,7 +1814,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
event
.
getTitle
())
self
.
assertEqual
(
title
,
event
.
getTitle
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertNotEqual
s
(
None
,
event
.
getStartDate
())
self
.
assertNotEqual
(
None
,
event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
event
.
getResource
())
event
.
getResource
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -1827,7 +1827,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -1827,7 +1827,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
event
.
getTitle
(),
title
)
self
.
assertEqual
(
event
.
getTitle
(),
title
)
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
event
.
getTextContent
())
self
.
assertNotEqual
s
(
None
,
event
.
getStartDate
())
self
.
assertNotEqual
(
None
,
event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
event
.
getResource
())
event
.
getResource
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
event
.
getDestination
(),
person
.
getRelativeUrl
())
...
@@ -1853,7 +1853,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
...
@@ -1853,7 +1853,7 @@ class TestSupportRequestTrySendNotificationMessage(SlapOSTestCaseMixin):
self
.
assertEqual
(
title
,
another_first_event
.
getTitle
())
self
.
assertEqual
(
title
,
another_first_event
.
getTitle
())
self
.
assertEqual
(
text_content
,
another_first_event
.
getTextContent
())
self
.
assertEqual
(
text_content
,
another_first_event
.
getTextContent
())
self
.
assertNotEqual
s
(
None
,
another_first_event
.
getStartDate
())
self
.
assertNotEqual
(
None
,
another_first_event
.
getStartDate
())
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
self
.
assertEqual
(
"service_module/slapos_crm_information"
,
another_first_event
.
getResource
())
another_first_event
.
getResource
())
self
.
assertEqual
(
another_first_event
.
getDestination
(),
person
.
getRelativeUrl
())
self
.
assertEqual
(
another_first_event
.
getDestination
(),
person
.
getRelativeUrl
())
...
...
master/bt5/slapos_erp5/TestTemplateItem/portal_components/test.erp5.testSlapOSERP5InteractionWorkflow.py
View file @
ecc0d024
...
@@ -38,9 +38,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -38,9 +38,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
.
edit
(
allocation_scope
=
allocation_scope
)
computer
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
s
(
computer
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
computer
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
s
(
computer
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
(
computer
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
expected_upgrade_scope
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
expected_upgrade_scope
)
return
computer
return
computer
def
test_Computer_setAllocationScope_public_no_source_adm
(
self
):
def
test_Computer_setAllocationScope_public_no_source_adm
(
self
):
...
@@ -79,8 +79,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -79,8 +79,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
=
self
.
_test_Computer_setAllocationScope_public
(
computer
=
self
.
_test_Computer_setAllocationScope_public
(
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
''
])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
''
])
self
.
assertEqual
s
(
computer
.
getDestinationSection
(),
None
)
self
.
assertEqual
(
computer
.
getDestinationSection
(),
None
)
def
test_Computer_setAllocationScope_subscription_with_source_adm
(
self
):
def
test_Computer_setAllocationScope_subscription_with_source_adm
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
...
@@ -90,8 +90,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -90,8 +90,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
source_administration
=
person
.
getRelativeUrl
(),
source_administration
=
person
.
getRelativeUrl
(),
allocation_scope
=
"open/subscription"
)
allocation_scope
=
"open/subscription"
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
''
])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
''
])
self
.
assertEqual
s
(
computer
.
getDestinationSection
(),
None
)
self
.
assertEqual
(
computer
.
getDestinationSection
(),
None
)
def
_test_Computer_setAllocationScope_personal
(
self
,
def
_test_Computer_setAllocationScope_personal
(
self
,
...
@@ -109,29 +109,29 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -109,29 +109,29 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
.
edit
(
allocation_scope
=
'open/personal'
)
computer
.
edit
(
allocation_scope
=
'open/personal'
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
s
(
computer
.
getCapacityScope
(),
'open'
)
self
.
assertEqual
(
computer
.
getCapacityScope
(),
'open'
)
self
.
assertEqual
s
(
computer
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
(
computer
.
getMonitorScope
(),
'disabled'
)
return
computer
return
computer
def
test_Computer_setAllocationScope_personal
(
self
):
def
test_Computer_setAllocationScope_personal
(
self
):
computer
=
self
.
_test_Computer_setAllocationScope_personal
()
computer
=
self
.
_test_Computer_setAllocationScope_personal
()
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
s
(
computer
.
getDestinationSection
(),
None
)
self
.
assertEqual
(
computer
.
getDestinationSection
(),
None
)
def
test_Computer_setAllocationScope_personal_upgrade_disabled
(
self
):
def
test_Computer_setAllocationScope_personal_upgrade_disabled
(
self
):
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
upgrade_scope
=
"disabled"
)
upgrade_scope
=
"disabled"
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
'disabled'
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
'disabled'
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
s
(
computer
.
getDestinationSection
(),
None
)
self
.
assertEqual
(
computer
.
getDestinationSection
(),
None
)
def
test_Computer_setAllocationScope_personal_upgrade_auto
(
self
):
def
test_Computer_setAllocationScope_personal_upgrade_auto
(
self
):
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
upgrade_scope
=
"auto"
)
upgrade_scope
=
"auto"
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
'auto'
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
'auto'
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[])
self
.
assertEqual
s
(
computer
.
getDestinationSection
(),
None
)
self
.
assertEqual
(
computer
.
getDestinationSection
(),
None
)
def
test_Computer_setAllocationScope_personal_with_source_adm
(
self
):
def
test_Computer_setAllocationScope_personal_with_source_adm
(
self
):
person
=
self
.
makePerson
()
person
=
self
.
makePerson
()
...
@@ -141,9 +141,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -141,9 +141,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
computer
=
self
.
_test_Computer_setAllocationScope_personal
(
source_administration
=
person
.
getRelativeUrl
(),
source_administration
=
person
.
getRelativeUrl
(),
)
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
test_Computer_setAllocationScope_personal_with_subject_list
(
self
):
def
test_Computer_setAllocationScope_personal_with_subject_list
(
self
):
...
@@ -155,9 +155,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -155,9 +155,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
source_administration
=
person
.
getRelativeUrl
(),
source_administration
=
person
.
getRelativeUrl
(),
subject_list
=
[
"some@example.com"
]
subject_list
=
[
"some@example.com"
]
)
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
'ask_confirmation'
)
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
_test_Computer_setAllocationScope_friend
(
self
,
def
_test_Computer_setAllocationScope_friend
(
self
,
...
@@ -179,9 +179,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -179,9 +179,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
.
edit
(
allocation_scope
=
'open/friend'
)
computer
.
edit
(
allocation_scope
=
'open/friend'
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
s
(
computer
.
getCapacityScope
(),
'open'
)
self
.
assertEqual
(
computer
.
getCapacityScope
(),
'open'
)
self
.
assertEqual
s
(
computer
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
(
computer
.
getMonitorScope
(),
'enabled'
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
expected_upgrade_scope
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
expected_upgrade_scope
)
return
computer
return
computer
def
test_Computer_setAllocationScope_friend_no_source_adm
(
self
):
def
test_Computer_setAllocationScope_friend_no_source_adm
(
self
):
...
@@ -204,8 +204,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -204,8 +204,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
=
self
.
_test_Computer_setAllocationScope_friend
(
computer
=
self
.
_test_Computer_setAllocationScope_friend
(
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
test_Computer_setAllocationScope_friend_with_subject_list
(
self
):
def
test_Computer_setAllocationScope_friend_with_subject_list
(
self
):
...
@@ -221,7 +221,7 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -221,7 +221,7 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
self
.
assertSameSet
(
computer
.
getSubjectList
(),
self
.
assertSameSet
(
computer
.
getSubjectList
(),
[
'some@example.com'
,
person
.
getDefaultEmailCoordinateText
()])
[
'some@example.com'
,
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
...
@@ -241,9 +241,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -241,9 +241,9 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
.
edit
(
allocation_scope
=
allocation_scope
)
computer
.
edit
(
allocation_scope
=
allocation_scope
)
self
.
commit
()
self
.
commit
()
self
.
assertEqual
s
(
computer
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
(
computer
.
getCapacityScope
(),
'close'
)
self
.
assertEqual
s
(
computer
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
(
computer
.
getMonitorScope
(),
'disabled'
)
self
.
assertEqual
s
(
computer
.
getUpgradeScope
(),
upgrade_scope
)
self
.
assertEqual
(
computer
.
getUpgradeScope
(),
upgrade_scope
)
return
computer
return
computer
...
@@ -258,8 +258,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -258,8 +258,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
computer
=
self
.
_test_Computer_setAllocationScope_closed
(
computer
=
self
.
_test_Computer_setAllocationScope_closed
(
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
test_Computer_setAllocationScope_closed_termination_no_source_adm
(
self
):
def
test_Computer_setAllocationScope_closed_termination_no_source_adm
(
self
):
...
@@ -276,8 +276,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -276,8 +276,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
allocation_scope
=
"close/termination"
,
allocation_scope
=
"close/termination"
,
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
test_Computer_setAllocationScope_closed_outdated_no_source_adm
(
self
):
def
test_Computer_setAllocationScope_closed_outdated_no_source_adm
(
self
):
...
@@ -294,8 +294,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -294,8 +294,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
allocation_scope
=
"close/outdated"
,
allocation_scope
=
"close/outdated"
,
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
def
test_Computer_setAllocationScope_closed_maintenance_no_source_adm
(
self
):
def
test_Computer_setAllocationScope_closed_maintenance_no_source_adm
(
self
):
...
@@ -312,8 +312,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
...
@@ -312,8 +312,8 @@ class TestSlapOSERP5InteractionWorkflowComputerSetAllocationScope(
allocation_scope
=
"close/maintenance"
,
allocation_scope
=
"close/maintenance"
,
source_administration
=
person
.
getRelativeUrl
())
source_administration
=
person
.
getRelativeUrl
())
self
.
assertEqual
s
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
(
computer
.
getSubjectList
(),
[
person
.
getDefaultEmailCoordinateText
()])
self
.
assertEqual
s
(
computer
.
getDestinationSectionList
(),
self
.
assertEqual
(
computer
.
getDestinationSectionList
(),
[
person
.
getRelativeUrl
()])
[
person
.
getRelativeUrl
()])
...
...
master/bt5/slapos_jio/TestTemplateItem/portal_components/test.erp5.testSlapOSHalJsonStyleSkins.py
View file @
ecc0d024
...
@@ -141,7 +141,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -141,7 +141,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
hosting_subscription
=
self
.
_makeHostingSubscription
()
hosting_subscription
=
self
.
_makeHostingSubscription
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[]}
expected_news_dict
=
{
'instance'
:
[]}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -150,7 +150,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -150,7 +150,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
hosting_subscription
.
setRootSlave
(
1
)
hosting_subscription
.
setRootSlave
(
1
)
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[],
'is_slave'
:
1
}
expected_news_dict
=
{
'instance'
:
[],
'is_slave'
:
1
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -159,7 +159,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -159,7 +159,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
hosting_subscription
.
getSlapState
=
fakeStopRequestedSlapState
hosting_subscription
.
getSlapState
=
fakeStopRequestedSlapState
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[],
'is_stopped'
:
1
}
expected_news_dict
=
{
'instance'
:
[],
'is_stopped'
:
1
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -168,7 +168,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -168,7 +168,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
hosting_subscription
.
getSlapState
=
fakeDestroyRequestedSlapState
hosting_subscription
.
getSlapState
=
fakeDestroyRequestedSlapState
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[],
'is_destroyed'
:
1
}
expected_news_dict
=
{
'instance'
:
[],
'is_destroyed'
:
1
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -182,7 +182,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -182,7 +182,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
expected_news_dict
=
{
'instance'
:
[{
'no_data'
:
1
,
expected_news_dict
=
{
'instance'
:
[{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
'user'
:
'SlapOS Master'
}]}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -194,7 +194,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -194,7 +194,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
changeSkin
(
'Hal'
)
self
.
changeSkin
(
'Hal'
)
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
news_dict
=
hosting_subscription
.
HostingSubscription_getNewsDict
()
expected_news_dict
=
{
'instance'
:
[]}
expected_news_dict
=
{
'instance'
:
[]}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -214,7 +214,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -214,7 +214,7 @@ class TestHostingSubscription_getNewsDict(TestSlapOSHalJsonStyleMixin):
{
'no_data'
:
1
,
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}]}
'user'
:
'SlapOS Master'
}]}
self
.
assertEqual
s
(
news_dict
[
"instance"
],
expected_news_dict
[
"instance"
])
self
.
assertEqual
(
news_dict
[
"instance"
],
expected_news_dict
[
"instance"
])
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -231,7 +231,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -231,7 +231,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
'state'
:
'start_requested'
,
'state'
:
'start_requested'
,
'text'
:
u'#access OK'
,
'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}
u'user'
:
u'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -242,7 +242,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -242,7 +242,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
expected_news_dict
=
{
'no_data'
:
1
,
expected_news_dict
=
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'text'
:
'#error no data found for %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}
'user'
:
'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -252,7 +252,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -252,7 +252,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
expected_news_dict
=
{
'is_slave'
:
1
,
expected_news_dict
=
{
'is_slave'
:
1
,
'text'
:
'#nodata is a slave %s'
%
instance
.
getReference
(),
'text'
:
'#nodata is a slave %s'
%
instance
.
getReference
(),
'user'
:
'SlapOS Master'
}
'user'
:
'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -265,7 +265,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -265,7 +265,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
"text"
:
"#nodata is an stopped instance %s"
%
instance
.
getReference
(),
"text"
:
"#nodata is an stopped instance %s"
%
instance
.
getReference
(),
"is_stopped"
:
1
"is_stopped"
:
1
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -278,7 +278,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -278,7 +278,7 @@ class TestSoftwareInstance_getNewsDict(TestSlapOSHalJsonStyleMixin):
"text"
:
"#nodata is an destroyed instance %s"
%
instance
.
getReference
(),
"text"
:
"#nodata is an destroyed instance %s"
%
instance
.
getReference
(),
"is_destroyed"
:
1
"is_destroyed"
:
1
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -295,7 +295,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -295,7 +295,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
'state'
:
'start_requested'
,
'state'
:
'start_requested'
,
'text'
:
u'#access OK'
,
'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}
u'user'
:
u'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -313,7 +313,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -313,7 +313,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
'state'
:
'stop_requested'
,
'state'
:
'stop_requested'
,
'text'
:
u'#access OK'
,
'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}
u'user'
:
u'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -331,7 +331,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -331,7 +331,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
'state'
:
'destroy_requested'
,
'state'
:
'destroy_requested'
,
'text'
:
u'#access OK'
,
'text'
:
u'#access OK'
,
u'user'
:
u'SlapOS Master'
}
u'user'
:
u'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -341,7 +341,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -341,7 +341,7 @@ class TestSoftwareInstallation_getNewsDict(TestSlapOSHalJsonStyleMixin):
expected_news_dict
=
{
'no_data'
:
1
,
expected_news_dict
=
{
'no_data'
:
1
,
'text'
:
'#error no data found for %s'
%
installation
.
getReference
(),
'text'
:
'#error no data found for %s'
%
installation
.
getReference
(),
'user'
:
'SlapOS Master'
}
'user'
:
'SlapOS Master'
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -361,7 +361,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -361,7 +361,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
u'user'
:
u'SlapOS Master'
},
u'user'
:
u'SlapOS Master'
},
'partition'
:
{}
'partition'
:
{}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -382,7 +382,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -382,7 +382,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
'user'
:
'SlapOS Master'
},
'user'
:
'SlapOS Master'
},
'partition'
:
{}
'partition'
:
{}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -403,7 +403,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -403,7 +403,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
'user'
:
u'SlapOS Master'
},
'user'
:
u'SlapOS Master'
},
'partition'
:
{}
'partition'
:
{}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -416,7 +416,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -416,7 +416,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
'user'
:
'SlapOS Master'
},
'user'
:
'SlapOS Master'
},
'partition'
:
{}
'partition'
:
{}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -440,7 +440,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -440,7 +440,7 @@ class TestComputer_getNewsDict(TestSlapOSHalJsonStyleMixin):
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'text'
:
'#error no data found for %s'
%
(
instance
.
getReference
()),
'user'
:
'SlapOS Master'
}}
'user'
:
'SlapOS Master'
}}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -475,7 +475,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -475,7 +475,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
}
}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -484,7 +484,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -484,7 +484,7 @@ class TestComputerNetwork_getNewsDict(TestSlapOSHalJsonStyleMixin):
self
.
_logFakeAccess
(
network
.
getReference
())
self
.
_logFakeAccess
(
network
.
getReference
())
news_dict
=
network
.
ComputerNetwork_getNewsDict
()
news_dict
=
network
.
ComputerNetwork_getNewsDict
()
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -521,7 +521,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -521,7 +521,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
}
}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -529,7 +529,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -529,7 +529,7 @@ class TestOrganisation_getNewsDict(TestSlapOSHalJsonStyleMixin):
organisation
=
self
.
_makeOrganisation
()
organisation
=
self
.
_makeOrganisation
()
news_dict
=
organisation
.
Organisation_getNewsDict
()
news_dict
=
organisation
.
Organisation_getNewsDict
()
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -566,7 +566,7 @@ class TestProject_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -566,7 +566,7 @@ class TestProject_getNewsDict(TestSlapOSHalJsonStyleMixin):
}
}
}
}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
@@ -574,7 +574,7 @@ class TestProject_getNewsDict(TestSlapOSHalJsonStyleMixin):
...
@@ -574,7 +574,7 @@ class TestProject_getNewsDict(TestSlapOSHalJsonStyleMixin):
project
=
self
.
_makeProject
()
project
=
self
.
_makeProject
()
news_dict
=
project
.
Project_getNewsDict
()
news_dict
=
project
.
Project_getNewsDict
()
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
expected_news_dict
=
{
'computer'
:
{},
'partition'
:
{}}
self
.
assertEqual
s
(
news_dict
,
expected_news_dict
)
self
.
assertEqual
(
news_dict
,
expected_news_dict
)
# Ensure it don't raise error when converting to JSON
# Ensure it don't raise error when converting to JSON
json
.
dumps
(
news_dict
)
json
.
dumps
(
news_dict
)
...
...
master/bt5/slapos_slap_tool/TestTemplateItem/portal_components/test.erp5.testSlapOSSlapTool.py
View file @
ecc0d024
...
@@ -1657,9 +1657,9 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
...
@@ -1657,9 +1657,9 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSSlapToolMixin):
xml_fp
.
seek
(
0
)
xml_fp
.
seek
(
0
)
got_xml
=
xml_fp
.
read
()
got_xml
=
xml_fp
.
read
()
self
.
assertNotEqual
s
(
created_at
,
ncreated_at
)
self
.
assertNotEqual
(
created_at
,
ncreated_at
)
self
.
assertNotEqual
s
(
since
,
ncreated_at
)
self
.
assertNotEqual
(
since
,
ncreated_at
)
self
.
assertEqual
s
(
since
,
created_at
)
self
.
assertEqual
(
since
,
created_at
)
expected_xml
=
"""
\
expected_xml
=
"""
\
<?xml version='1.0' encoding='UTF-8'?>
<?xml version='1.0' encoding='UTF-8'?>
...
...
master/bt5/slapos_subscription_request/TestTemplateItem/portal_components/test.erp5.testSlapOSSubscriptionScenario.py
View file @
ecc0d024
...
@@ -1123,7 +1123,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -1123,7 +1123,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
expected_test_payment_balance
,
self
.
assertEqual
(
expected_test_payment_balance
,
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
self
.
assertEqual
s
(
'start_requested'
,
self
.
assertEqual
(
'start_requested'
,
subscription_request
.
getAggregateValue
().
getSlapState
())
subscription_request
.
getAggregateValue
().
getSlapState
())
# The alarms might be called multiple times for move each step
# The alarms might be called multiple times for move each step
...
@@ -1134,7 +1134,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -1134,7 +1134,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertEqual
(
expected_test_payment_balance
,
self
.
assertEqual
(
expected_test_payment_balance
,
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
self
.
assertEqual
s
(
expected_slap_state_after_subscription_is_confirmed
,
self
.
assertEqual
(
expected_slap_state_after_subscription_is_confirmed
,
subscription_request
.
getAggregateValue
().
getSlapState
())
subscription_request
.
getAggregateValue
().
getSlapState
())
def
checkSubscriptionDeploymentAndSimulationWithReversalTransaction
(
self
,
default_email_text
,
subscription_server
):
def
checkSubscriptionDeploymentAndSimulationWithReversalTransaction
(
self
,
default_email_text
,
subscription_server
):
...
@@ -1168,7 +1168,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -1168,7 +1168,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertTrue
(
self
.
assertTrue
(
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
self
.
assertEqual
s
(
'start_requested'
,
self
.
assertEqual
(
'start_requested'
,
subscription_request
.
getAggregateValue
().
getSlapState
())
subscription_request
.
getAggregateValue
().
getSlapState
())
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
...
@@ -1204,7 +1204,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -1204,7 +1204,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
self
.
assertTrue
(
self
.
assertTrue
(
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
subscription_request
.
SubscriptionRequest_testPaymentBalance
())
self
.
assertEqual
s
(
'start_requested'
,
self
.
assertEqual
(
'start_requested'
,
subscription_request
.
getAggregateValue
().
getSlapState
())
subscription_request
.
getAggregateValue
().
getSlapState
())
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
self
.
checkStartedSubscriptionRequest
(
subscription_request
,
...
@@ -1219,7 +1219,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
...
@@ -1219,7 +1219,7 @@ class TestSlapOSSubscriptionScenarioMixin(DefaultScenarioMixin):
default_email_text
,
self
.
subscription_condition
)
default_email_text
,
self
.
subscription_condition
)
for
subscription_request
in
subscription_request_list
:
for
subscription_request
in
subscription_request_list
:
self
.
assertEqual
s
(
'start_requested'
,
self
.
assertEqual
(
'start_requested'
,
subscription_request
.
getAggregateValue
().
getSlapState
())
subscription_request
.
getAggregateValue
().
getSlapState
())
# Destroy all instances and process
# Destroy all instances and process
...
...
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
View file @
ecc0d024
...
@@ -48,7 +48,7 @@ class TestUpgradeInstanceWithOldDataFs(testSlapOSMixin):
...
@@ -48,7 +48,7 @@ class TestUpgradeInstanceWithOldDataFs(testSlapOSMixin):
alarm
=
self
.
portal
.
portal_alarms
.
promise_check_upgrade
alarm
=
self
.
portal
.
portal_alarms
.
promise_check_upgrade
alarm
.
solve
()
alarm
.
solve
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
s
(
alarm
.
getLastActiveProcess
().
getResultList
(),
[])
self
.
assertEqual
(
alarm
.
getLastActiveProcess
().
getResultList
(),
[])
bt5_list
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplateTitleList
()
bt5_list
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplateTitleList
()
self
.
assertTrue
(
'slapos_erp5'
in
bt5_list
,
bt5_list
)
self
.
assertTrue
(
'slapos_erp5'
in
bt5_list
,
bt5_list
)
...
@@ -63,7 +63,7 @@ class TestUpgradeInstanceWithOldDataFs(testSlapOSMixin):
...
@@ -63,7 +63,7 @@ class TestUpgradeInstanceWithOldDataFs(testSlapOSMixin):
portal_type_class
.
loadClass
()
portal_type_class
.
loadClass
()
if
issubclass
(
portal_type_class
,
ERP5BaseBroken
):
if
issubclass
(
portal_type_class
,
ERP5BaseBroken
):
error_list
.
append
(
portal_type_id
)
error_list
.
append
(
portal_type_id
)
self
.
assertEqual
s
(
self
.
assertEqual
(
error_list
,
[],
error_list
,
[],
msg
=
"The following Portal Type classes could not be loaded (see zLOG.log): %r"
%
error_list
)
msg
=
"The following Portal Type classes could not be loaded (see zLOG.log): %r"
%
error_list
)
...
...
slapos/tests/test_cli.py
View file @
ecc0d024
...
@@ -73,7 +73,7 @@ class TestCliCache(CliMixin):
...
@@ -73,7 +73,7 @@ class TestCliCache(CliMixin):
test_url
=
"https://lab.nexedi.com/nexedi/slapos/raw/1.0.102/software/slaprunner/software.cfg"
test_url
=
"https://lab.nexedi.com/nexedi/slapos/raw/1.0.102/software/slaprunner/software.cfg"
def
test_cached_binary
(
self
):
def
test_cached_binary
(
self
):
self
.
assertEqual
s
(
0
,
cache_do_lookup
(
self
.
assertEqual
(
0
,
cache_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://dir.shacache.org"
,
cache_dir
=
"http://dir.shacache.org"
,
software_url
=
self
.
test_url
))
software_url
=
self
.
test_url
))
...
@@ -90,7 +90,7 @@ class TestCliCache(CliMixin):
...
@@ -90,7 +90,7 @@ class TestCliCache(CliMixin):
self
.
logger
.
info
.
assert_any_call
(
u'------------------------------------------'
)
self
.
logger
.
info
.
assert_any_call
(
u'------------------------------------------'
)
def
test_uncached_binary
(
self
):
def
test_uncached_binary
(
self
):
self
.
assertEqual
s
(
10
,
cache_do_lookup
(
self
.
assertEqual
(
10
,
cache_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://dir.shacache.org"
,
cache_dir
=
"http://dir.shacache.org"
,
software_url
=
"this_is_uncached_url"
))
software_url
=
"this_is_uncached_url"
))
...
@@ -98,7 +98,7 @@ class TestCliCache(CliMixin):
...
@@ -98,7 +98,7 @@ class TestCliCache(CliMixin):
self
.
logger
.
critical
.
assert_any_call
(
'Object not in cache: %s'
,
'this_is_uncached_url'
)
self
.
logger
.
critical
.
assert_any_call
(
'Object not in cache: %s'
,
'this_is_uncached_url'
)
def
test_bad_cache_dir
(
self
):
def
test_bad_cache_dir
(
self
):
self
.
assertEqual
s
(
10
,
cache_do_lookup
(
self
.
assertEqual
(
10
,
cache_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://xxx.shacache.org"
,
cache_dir
=
"http://xxx.shacache.org"
,
software_url
=
self
.
test_url
))
software_url
=
self
.
test_url
))
...
@@ -112,7 +112,7 @@ class TestCliCacheSource(CliMixin):
...
@@ -112,7 +112,7 @@ class TestCliCacheSource(CliMixin):
test_url
=
"https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.17.1.tar.xz"
test_url
=
"https://mirrors.edge.kernel.org/pub/software/scm/git/git-2.17.1.tar.xz"
def
test_cached_source
(
self
):
def
test_cached_source
(
self
):
self
.
assertEqual
s
(
0
,
cache_source_do_lookup
(
self
.
assertEqual
(
0
,
cache_source_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://dir.shacache.org"
,
cache_dir
=
"http://dir.shacache.org"
,
url
=
self
.
test_url
))
url
=
self
.
test_url
))
...
@@ -147,7 +147,7 @@ class TestCliCacheSource(CliMixin):
...
@@ -147,7 +147,7 @@ class TestCliCacheSource(CliMixin):
'------------'
)
'------------'
)
def
test_uncached_binary
(
self
):
def
test_uncached_binary
(
self
):
self
.
assertEqual
s
(
10
,
cache_source_do_lookup
(
self
.
assertEqual
(
10
,
cache_source_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://dir.shacache.org"
,
cache_dir
=
"http://dir.shacache.org"
,
url
=
"this_is_uncached_url"
))
url
=
"this_is_uncached_url"
))
...
@@ -155,7 +155,7 @@ class TestCliCacheSource(CliMixin):
...
@@ -155,7 +155,7 @@ class TestCliCacheSource(CliMixin):
self
.
logger
.
critical
.
assert_any_call
(
'Object not in cache: %s'
,
'this_is_uncached_url'
)
self
.
logger
.
critical
.
assert_any_call
(
'Object not in cache: %s'
,
'this_is_uncached_url'
)
def
test_bad_cache_dir
(
self
):
def
test_bad_cache_dir
(
self
):
self
.
assertEqual
s
(
10
,
cache_source_do_lookup
(
self
.
assertEqual
(
10
,
cache_source_do_lookup
(
self
.
logger
,
self
.
logger
,
cache_dir
=
"http://xxx.shacache.org"
,
cache_dir
=
"http://xxx.shacache.org"
,
url
=
self
.
test_url
))
url
=
self
.
test_url
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment