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
Léo-Paul Géneau
slapos.core
Commits
96c0b199
Commit
96c0b199
authored
Jun 26, 2018
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: (test) Cloud Contract is enable/disable by preference
parent
c6b86449
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
1 deletion
+57
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.py
...em/portal_components/test.erp5.testSlapOSContractSkins.py
+54
-0
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.xml
...m/portal_components/test.erp5.testSlapOSContractSkins.xml
+3
-1
No files found.
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.py
View file @
96c0b199
...
@@ -3,6 +3,7 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
...
@@ -3,6 +3,7 @@ from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixinWithAbort
from
zExceptions
import
Unauthorized
from
zExceptions
import
Unauthorized
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
transaction
class
TestSlapOSSoftwareInstance_requestValidationPayment
(
SlapOSTestCaseMixinWithAbort
):
class
TestSlapOSSoftwareInstance_requestValidationPayment
(
SlapOSTestCaseMixinWithAbort
):
...
@@ -262,36 +263,89 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
...
@@ -262,36 +263,89 @@ class TestSlapOSPerson_isAllowedToAllocate(SlapOSTestCaseMixinWithAbort):
)
)
def
test_not_allowed_by_default
(
self
):
def
test_not_allowed_by_default
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
person
=
self
.
createPerson
()
preference
.
setPreferredCloudContractEnabled
(
True
)
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
def
test_not_allowed_by_default_with_disabled_preference
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
preference
.
setPreferredCloudContractEnabled
(
False
)
result
=
person
.
Person_isAllowedToAllocate
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
self
.
assertEquals
(
result
,
False
)
def
test_allowed_if_has_a_validated_contract
(
self
):
def
test_allowed_if_has_a_validated_contract
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
contract
.
edit
(
destination_section_value
=
person
destination_section_value
=
person
)
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
preference
.
setPreferredCloudContractEnabled
(
True
)
self
.
tic
()
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
True
)
self
.
assertEquals
(
result
,
True
)
def
test_allowed_if_has_a_validated_contract_with_disabled_preference
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
destination_section_value
=
person
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
preference
.
setPreferredCloudContractEnabled
(
0
)
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
True
)
def
test_not_allowed_if_has_an_invalidated_contract
(
self
):
def
test_not_allowed_if_has_an_invalidated_contract
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
contract
.
edit
(
destination_section_value
=
person
destination_section_value
=
person
)
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'invalidated'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'invalidated'
)
preference
.
setPreferredCloudContractEnabled
(
True
)
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
def
test_not_allowed_if_has_an_invalidated_contract_with_disabled_preference
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
contract
.
edit
(
destination_section_value
=
person
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'invalidated'
)
preference
.
setPreferredCloudContractEnabled
(
False
)
self
.
tic
()
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
self
.
assertEquals
(
result
,
False
)
def
test_not_allowed_if_no_related_contract
(
self
):
def
test_not_allowed_if_no_related_contract
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
contract
=
self
.
createCloudContract
()
preference
.
setPreferredCloudContractEnabled
(
True
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
self
.
tic
()
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
self
.
assertEquals
(
result
,
False
)
def
test_not_allowed_if_no_related_contract_with_disabled_preference
(
self
):
preference
=
self
.
portal
.
portal_preferences
.
getActiveSystemPreference
()
person
=
self
.
createPerson
()
contract
=
self
.
createCloudContract
()
preference
.
setPreferredCloudContractEnabled
(
0
)
self
.
portal
.
portal_workflow
.
_jumpToStateFor
(
contract
,
'validated'
)
self
.
tic
()
result
=
person
.
Person_isAllowedToAllocate
()
self
.
assertEquals
(
result
,
False
)
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSContractSkins.xml
View file @
96c0b199
...
@@ -45,7 +45,9 @@
...
@@ -45,7 +45,9 @@
<item>
<item>
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple/>
<tuple>
<string>
W: 6, 0: Unused import transaction (unused-import)
</string>
</tuple>
</value>
</value>
</item>
</item>
<item>
<item>
...
...
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