Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Papa Tamsir Kane
erp5
Commits
1fc4fc1b
Commit
1fc4fc1b
authored
Dec 09, 2016
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ConfiguratorTestMixin: Reduce reliance on Person.reference as a user id.
parent
bbc09fc2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
456 additions
and
434 deletions
+456
-434
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
+456
-434
No files found.
product/ERP5Configurator/tests/ConfiguratorTestMixin.py
View file @
1fc4fc1b
...
@@ -250,6 +250,17 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -250,6 +250,17 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
next_dict
.
setdefault
(
k
,
[]).
append
(
v
)
next_dict
.
setdefault
(
k
,
[]).
append
(
v
)
sequence
.
edit
(
next_dict
=
next_dict
)
sequence
.
edit
(
next_dict
=
next_dict
)
def
_getUserIdList
(
self
,
login_list
):
user_id_dict
=
{
x
[
'login'
]:
x
[
'id'
]
for
x
in
self
.
portal
.
acl_users
.
searchUsers
(
login
=
login_list
,
exact_match
=
True
,
)
}
self
.
assertSameSet
(
user_id_dict
,
login_list
)
return
user_id_dict
.
values
()
def
stepCheckMultiplePersonConfigurationItem
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCheckMultiplePersonConfigurationItem
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
"""
Check if multiple Person Configuration Item of the Business
Check if multiple Person Configuration Item of the Business
...
@@ -546,7 +557,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -546,7 +557,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
"""
"""
Test if gadget system is working.
Test if gadget system is working.
"""
"""
for
user_id
in
self
.
all_username_list
:
for
user_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user_id
)
self
.
_loginAsUser
(
user_id
)
knowledge_pad_module
=
self
.
portal
.
knowledge_pad_module
knowledge_pad_module
=
self
.
portal
.
knowledge_pad_module
knowledge_pad
=
knowledge_pad_module
.
newContent
(
portal_type
=
'Knowledge Pad'
)
knowledge_pad
=
knowledge_pad_module
.
newContent
(
portal_type
=
'Knowledge Pad'
)
...
@@ -560,78 +571,78 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -560,78 +571,78 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def
stepViewEventModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewEventModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" Everybody can view events. """
""" Everybody can view events. """
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
self
.
portal
.
event_module
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
self
.
portal
.
event_module
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
self
.
portal
.
event_module
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
self
.
portal
.
event_module
)
def
stepAddEvent
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddEvent
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" Everybody can add events. """
""" Everybody can add events. """
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAddDocument
(
user
name
,
self
.
portal
.
event_module
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
self
.
portal
.
event_module
)
for
event_type
in
(
'Visit'
,
'Web Message'
,
'Letter'
,
'Note'
,
for
event_type
in
(
'Visit'
,
'Web Message'
,
'Letter'
,
'Note'
,
'Phone Call'
,
'Mail Message'
,
'Fax Message'
):
'Phone Call'
,
'Mail Message'
,
'Fax Message'
):
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
event_type
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
event_type
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
event
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
event
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
event
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
event
)
def
stepSentEventWorkflow
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepSentEventWorkflow
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
for
event_type
in
(
'Visit'
,
'Web Message'
,
'Letter'
,
'Note'
,
for
event_type
in
(
'Visit'
,
'Web Message'
,
'Letter'
,
'Note'
,
'Phone Call'
,
'Mail Message'
,
'Fax Message'
):
'Phone Call'
,
'Mail Message'
,
'Fax Message'
):
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
event_type
)
event
=
self
.
portal
.
event_module
.
newContent
(
portal_type
=
event_type
)
# in draft state, we can view & modify
# in draft state, we can view & modify
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
event
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
event
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
event
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
event
)
self
.
failUnlessUserCanModifyDocument
(
user
name
,
event
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
event
)
# everybody can cancel from draft
# everybody can cancel from draft
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'cancel_action'
,
event
)
user
_id
,
'cancel_action'
,
event
)
# everybody can plan
# everybody can plan
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'plan_action'
,
event
)
user
_id
,
'plan_action'
,
event
)
event
.
plan
()
event
.
plan
()
self
.
assertEqual
(
'planned'
,
event
.
getSimulationState
())
self
.
assertEqual
(
'planned'
,
event
.
getSimulationState
())
# everybody can confirm or send a planned event
# everybody can confirm or send a planned event
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'confirm_action'
,
event
)
user
_id
,
'confirm_action'
,
event
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'start_action'
,
event
)
user
_id
,
'start_action'
,
event
)
event
.
start
()
event
.
start
()
self
.
assertEqual
(
'started'
,
event
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
event
.
getSimulationState
())
# everybody can deliver a sent event
# everybody can deliver a sent event
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'deliver_action'
,
event
)
user
_id
,
'deliver_action'
,
event
)
event
.
deliver
()
event
.
deliver
()
self
.
assertEqual
(
'delivered'
,
event
.
getSimulationState
())
self
.
assertEqual
(
'delivered'
,
event
.
getSimulationState
())
## Accounts {{{
## Accounts {{{
def
stepViewAccountModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccountModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" everybody can view and access account module. """
""" everybody can view and access account module. """
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
self
.
failUnlessUserCanViewDocument
(
user
_id
,
self
.
portal
.
account_module
)
self
.
portal
.
account_module
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
self
.
portal
.
account_module
)
self
.
portal
.
account_module
)
def
stepAddAccountModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddAccountModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
""" only accountants can add accounts. """
""" only accountants can add accounts. """
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanAddDocument
(
user
name
,
self
.
failUnlessUserCanAddDocument
(
user
_id
,
self
.
portal
.
account_module
)
self
.
portal
.
account_module
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanAddDocument
(
user
name
,
self
.
failIfUserCanAddDocument
(
user
_id
,
self
.
portal
.
account_module
)
self
.
portal
.
account_module
)
def
stepViewAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -640,60 +651,60 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -640,60 +651,60 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# in draft state,
# in draft state,
self
.
assertEqual
(
'draft'
,
account
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
account
.
getValidationState
())
# everybody can see
# everybody can see
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
account
)
# only accountants can modify
# only accountants can modify
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
account
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
account
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
account
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
account
)
# only accountants can validate
# only accountants can validate
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'validate_action'
,
account
)
user
_id
,
'validate_action'
,
account
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
'validate_action'
,
account
)
user
_id
,
'validate_action'
,
account
)
account
.
validate
()
account
.
validate
()
self
.
assertEqual
(
'validated'
,
account
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
account
.
getValidationState
())
# in validated state, every body can view, but *nobody* can modify
# in validated state, every body can view, but *nobody* can modify
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
account
)
self
.
failIfUserCanModifyDocument
(
user
name
,
account
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
account
)
# only accountants can invalidate
# only accountants can invalidate
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'invalidate_action'
,
account
)
user
_id
,
'invalidate_action'
,
account
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
'invalidate_action'
,
account
)
user
_id
,
'invalidate_action'
,
account
)
account
.
invalidate
()
account
.
invalidate
()
self
.
assertEqual
(
'invalidated'
,
account
.
getValidationState
())
self
.
assertEqual
(
'invalidated'
,
account
.
getValidationState
())
# back in invalidated state, everybody can view
# back in invalidated state, everybody can view
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
account
)
# only accountants can modify
# only accountants can modify
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
account
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
account
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
account
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
account
)
account
.
delete
()
account
.
delete
()
# nobody can view delete object, but we can still access, for safety
# nobody can view delete object, but we can still access, for safety
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failIfUserCanViewDocument
(
user
name
,
account
)
self
.
failIfUserCanViewDocument
(
user
_id
,
account
)
def
stepCopyPasteAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCopyPasteAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# tests copy / pasting accounts from account module
# tests copy / pasting accounts from account module
...
@@ -703,40 +714,40 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -703,40 +714,40 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'draft'
,
account
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
account
.
getValidationState
())
# everybody can see
# everybody can see
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
account
)
def
stepViewEntityModules
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewEntityModules
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Everybody can view entities.
# Everybody can view entities.
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
for
module
in
[
self
.
portal
.
person_module
,
for
module
in
[
self
.
portal
.
person_module
,
self
.
portal
.
organisation_module
]:
self
.
portal
.
organisation_module
]:
self
.
failUnlessUserCanViewDocument
(
user
name
,
module
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
module
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
module
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
module
)
def
stepAddEntityModules
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddEntityModules
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Everybody can add entities.
# Everybody can add entities.
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
for
module
in
[
self
.
portal
.
person_module
,
for
module
in
[
self
.
portal
.
person_module
,
self
.
portal
.
organisation_module
]:
self
.
portal
.
organisation_module
]:
self
.
failUnlessUserCanAddDocument
(
user
name
,
module
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
module
)
def
stepCopyAndPastePerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCopyAndPastePerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# copy & paste in person module
# copy & paste in person module
person
=
self
.
portal
.
person_module
.
newContent
(
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
portal_type
=
'Person'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
person
.
Base_createCloneDocument
()
person
.
Base_createCloneDocument
()
def
stepCopyAndPasteOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCopyAndPasteOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# copy & paste in organisation module
# copy & paste in organisation module
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
organisation
.
Base_createCloneDocument
()
organisation
.
Base_createCloneDocument
()
def
stepEntityWorkflow
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepEntityWorkflow
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -744,30 +755,30 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -744,30 +755,30 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
portal
.
organisation_module
]:
self
.
portal
.
organisation_module
]:
entity
=
module
.
newContent
()
entity
=
module
.
newContent
()
# in draft state, we can view, modify & add
# in draft state, we can view, modify & add
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanModifyDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
entity
)
# everybody can validate
# everybody can validate
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'validate_action'
,
entity
)
user
_id
,
'validate_action'
,
entity
)
entity
.
validate
()
entity
.
validate
()
self
.
assertEqual
(
'validated'
,
entity
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
entity
.
getValidationState
())
# in validated state, we can still modify
# in validated state, we can still modify
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanModifyDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
entity
)
# and invalidate
# and invalidate
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'invalidate_action'
,
entity
)
user
_id
,
'invalidate_action'
,
entity
)
def
stepViewCreatedPersons
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewCreatedPersons
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
...
@@ -776,9 +787,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -776,9 +787,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertNotEquals
(
0
,
len
(
person_list
))
self
.
assertNotEquals
(
0
,
len
(
person_list
))
for
entity
in
person_list
:
for
entity
in
person_list
:
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
entity
)
def
stepViewCreatedOrganisations
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewCreatedOrganisations
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
...
@@ -787,9 +798,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -787,9 +798,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertNotEquals
(
0
,
len
(
organisation_list
))
self
.
assertNotEquals
(
0
,
len
(
organisation_list
))
for
entity
in
organisation_list
:
for
entity
in
organisation_list
:
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
entity
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
entity
)
def
stepViewCreatedAssignemnts
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewCreatedAssignemnts
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
self
.
loginByUserName
(
user_name
=
'test_configurator_user'
)
...
@@ -801,9 +812,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -801,9 +812,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
found_one
=
0
found_one
=
0
for
assignment
in
person
.
contentValues
(
portal_type
=
'Assignment'
):
for
assignment
in
person
.
contentValues
(
portal_type
=
'Assignment'
):
found_one
=
1
found_one
=
1
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAccessDocument
(
user
name
,
assignment
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
assignment
)
self
.
failUnlessUserCanViewDocument
(
user
name
,
assignment
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
assignment
)
self
.
assertTrue
(
found_one
,
'No assignment found in %s'
%
person
)
self
.
assertTrue
(
found_one
,
'No assignment found in %s'
%
person
)
# }}}
# }}}
...
@@ -813,8 +824,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -813,8 +824,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# Everybody can add accounting periods.
# Everybody can add accounting periods.
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
assertTrue
(
'Accounting Period'
in
self
.
assertTrue
(
'Accounting Period'
in
organisation
.
getVisibleAllowedContentTypeList
())
organisation
.
getVisibleAllowedContentTypeList
())
...
@@ -834,42 +845,44 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -834,42 +845,44 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
accounting_period
.
getSimulationState
(),
'draft'
)
self
.
assertEqual
(
accounting_period
.
getSimulationState
(),
'draft'
)
# accountants can modify the period
# accountants can modify the period
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
accounting_period
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
accounting_period
)
# accountants can cancel the period
# accountants can cancel the period
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'cancel_action'
,
accounting_period
)
user
_id
,
'cancel_action'
,
accounting_period
)
# accountants can start the period
# accountants can start the period
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'start_action'
,
accounting_period
)
user
_id
,
'start_action'
,
accounting_period
)
# once the period is started, nobody can modify
# once the period is started, nobody can modify
accounting_period
.
start
()
accounting_period
.
start
()
self
.
assertEqual
(
'started'
,
accounting_period
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
accounting_period
.
getSimulationState
())
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failIfUserCanModifyDocument
(
user
name
,
accounting_period
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
accounting_period
)
# accountants can still cancel the period
# accountants can still cancel the period
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'cancel_action'
,
accounting_period
)
user
_id
,
'cancel_action'
,
accounting_period
)
# accountants can stop the period
# accountants can stop the period
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'stop_action'
,
accounting_period
)
user
_id
,
'stop_action'
,
accounting_period
)
# and reopen it
# and reopen it
accounting_period
.
stop
()
accounting_period
.
stop
()
self
.
assertEqual
(
'stopped'
,
accounting_period
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
accounting_period
.
getSimulationState
())
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'restart_action'
,
accounting_period
)
user
_id
,
'restart_action'
,
accounting_period
)
# but only accounting manager can close it
# but only accounting manager can close it
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
accounting_manager_reference
,
'deliver_action'
,
accounting_period
)
accounting_manager_id
,
'deliver_action'
,
accounting_period
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
accounting_agent_id
,
=
self
.
_getUserIdList
([
self
.
accounting_agent_reference
])
self
.
failIfUserCanPassWorkflowTransition
(
self
.
failIfUserCanPassWorkflowTransition
(
self
.
accounting_agent_reference
,
'deliver_action'
,
accounting_period
)
accounting_agent_id
,
'deliver_action'
,
accounting_period
)
# }}}
# }}}
...
@@ -881,15 +894,15 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -881,15 +894,15 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
bank_account
=
entity
.
newContent
(
portal_type
=
'Bank Account'
)
bank_account
=
entity
.
newContent
(
portal_type
=
'Bank Account'
)
# everybody can view in draft ...
# everybody can view in draft ...
self
.
assertEqual
(
'draft'
,
bank_account
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
bank_account
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
bank_account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
bank_account
)
# ... and validated states
# ... and validated states
bank_account
.
validate
()
bank_account
.
validate
()
self
.
assertEqual
(
'validated'
,
bank_account
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
bank_account
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
bank_account
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
bank_account
)
def
stepViewCreditCard
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewCreditCard
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Everybody can view credit cards
# Everybody can view credit cards
...
@@ -898,15 +911,15 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -898,15 +911,15 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
ext_payment
=
entity
.
newContent
(
portal_type
=
'Credit Card'
)
ext_payment
=
entity
.
newContent
(
portal_type
=
'Credit Card'
)
# every body can view in draft ...
# every body can view in draft ...
self
.
assertEqual
(
'draft'
,
ext_payment
.
getValidationState
())
self
.
assertEqual
(
'draft'
,
ext_payment
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
ext_payment
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
ext_payment
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
ext_payment
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
ext_payment
)
# ... and validated states
# ... and validated states
ext_payment
.
validate
()
ext_payment
.
validate
()
self
.
assertEqual
(
'validated'
,
ext_payment
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
ext_payment
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
ext_payment
)
self
.
failUnlessUserCanViewDocument
(
user
_id
,
ext_payment
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
ext_payment
)
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
ext_payment
)
def
stepValidateAndModifyBankAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepValidateAndModifyBankAccount
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Every body can modify Bank Accounts
# Every body can modify Bank Accounts
...
@@ -914,26 +927,26 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -914,26 +927,26 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
bank_account
=
entity
.
newContent
(
portal_type
=
'Bank Account'
)
bank_account
=
entity
.
newContent
(
portal_type
=
'Bank Account'
)
# draft
# draft
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
bank_account
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'validate_action'
,
bank_account
)
'validate_action'
,
bank_account
)
# validated
# validated
bank_account
.
validate
()
bank_account
.
validate
()
self
.
assertEqual
(
'validated'
,
bank_account
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
bank_account
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
bank_account
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'invalidate_action'
,
bank_account
)
'invalidate_action'
,
bank_account
)
# invalidated
# invalidated
bank_account
.
invalidate
()
bank_account
.
invalidate
()
self
.
assertEqual
(
'invalidated'
,
bank_account
.
getValidationState
())
self
.
assertEqual
(
'invalidated'
,
bank_account
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
bank_account
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
bank_account
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'validate_action'
,
bank_account
)
'validate_action'
,
bank_account
)
def
stepValidateAndModifyCreditCard
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepValidateAndModifyCreditCard
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -942,33 +955,33 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -942,33 +955,33 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
credit_card
=
entity
.
newContent
(
portal_type
=
'Credit Card'
)
credit_card
=
entity
.
newContent
(
portal_type
=
'Credit Card'
)
# draft
# draft
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
credit_card
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
credit_card
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'validate_action'
,
credit_card
)
'validate_action'
,
credit_card
)
# validated
# validated
credit_card
.
validate
()
credit_card
.
validate
()
self
.
assertEqual
(
'validated'
,
credit_card
.
getValidationState
())
self
.
assertEqual
(
'validated'
,
credit_card
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
credit_card
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
credit_card
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'invalidate_action'
,
credit_card
)
'invalidate_action'
,
credit_card
)
# invalidated
# invalidated
credit_card
.
invalidate
()
credit_card
.
invalidate
()
self
.
assertEqual
(
'invalidated'
,
credit_card
.
getValidationState
())
self
.
assertEqual
(
'invalidated'
,
credit_card
.
getValidationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
credit_card
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
credit_card
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'validate_action'
,
credit_card
)
'validate_action'
,
credit_card
)
def
stepAddPaymentNodeInPerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddPaymentNodeInPerson
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
person
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
person
)
self
.
assertTrue
(
'Bank Account'
in
self
.
assertTrue
(
'Bank Account'
in
person
.
getVisibleAllowedContentTypeList
())
person
.
getVisibleAllowedContentTypeList
())
self
.
assertTrue
(
'Credit Card'
in
self
.
assertTrue
(
'Credit Card'
in
...
@@ -976,9 +989,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -976,9 +989,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# when the entity is validated, we can still add some payment nodes
# when the entity is validated, we can still add some payment nodes
person
.
validate
()
person
.
validate
()
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
portal
.
portal_caches
.
clearAllCache
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
person
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
person
)
self
.
assertTrue
(
'Bank Account'
in
self
.
assertTrue
(
'Bank Account'
in
person
.
getVisibleAllowedContentTypeList
())
person
.
getVisibleAllowedContentTypeList
())
self
.
assertTrue
(
'Credit Card'
in
self
.
assertTrue
(
'Credit Card'
in
...
@@ -987,9 +1000,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -987,9 +1000,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def
stepAddPaymentNodeInOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddPaymentNodeInOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
org
=
self
.
portal
.
organisation_module
.
newContent
(
org
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
org
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
org
)
self
.
assertTrue
(
'Bank Account'
in
self
.
assertTrue
(
'Bank Account'
in
org
.
getVisibleAllowedContentTypeList
())
org
.
getVisibleAllowedContentTypeList
())
self
.
assertTrue
(
'Credit Card'
in
self
.
assertTrue
(
'Credit Card'
in
...
@@ -997,9 +1010,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -997,9 +1010,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# when the entity is validated, we can still add some payment nodes
# when the entity is validated, we can still add some payment nodes
org
.
validate
()
org
.
validate
()
self
.
portal
.
portal_caches
.
clearAllCache
()
self
.
portal
.
portal_caches
.
clearAllCache
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
org
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
org
)
self
.
assertTrue
(
'Bank Account'
in
self
.
assertTrue
(
'Bank Account'
in
org
.
getVisibleAllowedContentTypeList
())
org
.
getVisibleAllowedContentTypeList
())
self
.
assertTrue
(
'Credit Card'
in
self
.
assertTrue
(
'Credit Card'
in
...
@@ -1011,8 +1024,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1011,8 +1024,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
bank_account
=
person
.
newContent
(
bank_account
=
person
.
newContent
(
portal_type
=
'Bank Account'
)
portal_type
=
'Bank Account'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
bank_account
.
Base_createCloneDocument
()
bank_account
.
Base_createCloneDocument
()
def
stepCopyAndPasteBankAccountInOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCopyAndPasteBankAccountInOrganisation
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -1021,24 +1034,24 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1021,24 +1034,24 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
portal_type
=
'Organisation'
)
portal_type
=
'Organisation'
)
bank_account
=
organisation
.
newContent
(
bank_account
=
organisation
.
newContent
(
portal_type
=
'Bank Account'
)
portal_type
=
'Bank Account'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
bank_account
.
Base_createCloneDocument
()
bank_account
.
Base_createCloneDocument
()
# }}}
# }}}
## Accounting Module {{{
## Accounting Module {{{
def
stepViewAccountingTransactionModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccountingTransactionModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanViewDocument
(
user
name
,
self
.
failUnlessUserCanViewDocument
(
user
_id
,
self
.
portal
.
accounting_module
)
self
.
portal
.
accounting_module
)
self
.
failUnlessUserCanAccessDocument
(
user
name
,
self
.
failUnlessUserCanAccessDocument
(
user
_id
,
self
.
portal
.
accounting_module
)
self
.
portal
.
accounting_module
)
def
stepAddAccountingTransactionModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddAccountingTransactionModule
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# Anyone can adds accounting transactions
# Anyone can adds accounting transactions
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanAddDocument
(
user
name
,
self
.
failUnlessUserCanAddDocument
(
user
_id
,
self
.
portal
.
accounting_module
)
self
.
portal
.
accounting_module
)
def
stepCopyAndPasteAccountingTransactions
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepCopyAndPasteAccountingTransactions
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
...
@@ -1047,8 +1060,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1047,8 +1060,8 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
if
portal_type
!=
'Balance Transaction'
:
if
portal_type
!=
'Balance Transaction'
:
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
portal_type
)
portal_type
=
portal_type
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
transaction
.
Base_createCloneDocument
()
transaction
.
Base_createCloneDocument
()
def
_getAccountingTransactionTypeList
(
self
):
def
_getAccountingTransactionTypeList
(
self
):
...
@@ -1062,47 +1075,47 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1062,47 +1075,47 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
start_date
=
DateTime
(
2001
,
01
,
01
),
start_date
=
DateTime
(
2001
,
01
,
01
),
stop_date
=
DateTime
(
2001
,
01
,
01
))
stop_date
=
DateTime
(
2001
,
01
,
01
))
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'start_action'
,
'start_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
# TODO
# TODO
### self.failUnlessUserCanPassWorkflowTransition(user
name
,
### self.failUnlessUserCanPassWorkflowTransition(user
_id
,
### 'delete_action',
### 'delete_action',
### transaction)
### transaction)
...
@@ -1111,55 +1124,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1111,55 +1124,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# only accountant can modify
# only accountant can modify
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
# only accountant can "stop"
# only accountant can "stop"
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
transaction
.
stop
()
transaction
.
stop
()
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# nobody can modify
# nobody can modify
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
# in started state, we can modify again, and go back to stopped state
# in started state, we can modify again, and go back to stopped state
...
@@ -1167,9 +1180,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1167,9 +1180,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
...
@@ -1178,11 +1191,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1178,11 +1191,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
# only accounting_manager can validate
# only accounting_manager can validate
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
accounting_manager_reference
,
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
failUnlessUserCanPassWorkflowTransition
(
accounting_manager_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
self
.
failIfUserCanPassWorkflowTransition
(
self
.
accounting_agent_reference
,
accounting_agent_id
,
=
self
.
_getUserIdList
([
self
.
accounting_agent_reference
])
self
.
failIfUserCanPassWorkflowTransition
(
accounting_agent_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
...
@@ -1192,57 +1207,57 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1192,57 +1207,57 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
start_date
=
DateTime
(
2001
,
01
,
01
),
start_date
=
DateTime
(
2001
,
01
,
01
),
stop_date
=
DateTime
(
2001
,
01
,
01
))
stop_date
=
DateTime
(
2001
,
01
,
01
))
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
-
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
-
self
.
sales_and_purchase_username_list
):
self
.
sales_and_purchase_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
# TODO
# TODO
### self.failUnlessUserCanPassWorkflowTransition(user
name
,
### self.failUnlessUserCanPassWorkflowTransition(user
_id
,
### 'delete_action',
### 'delete_action',
### transaction)
### transaction)
...
@@ -1251,55 +1266,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1251,55 +1266,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# only accountant can modify
# only accountant can modify
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
# only accountant can "stop"
# only accountant can "stop"
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
transaction
.
stop
()
transaction
.
stop
()
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# nobody can modify
# nobody can modify
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
# in started state, we can modify again, and go back to stopped state
# in started state, we can modify again, and go back to stopped state
...
@@ -1307,9 +1322,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1307,9 +1322,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
...
@@ -1318,11 +1333,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1318,11 +1333,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
# only accounting_manager can validate
# only accounting_manager can validate
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
accounting_manager_reference
,
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
failUnlessUserCanPassWorkflowTransition
(
accounting_manager_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
self
.
failIfUserCanPassWorkflowTransition
(
self
.
accounting_agent_reference
,
accounting_agent_id
,
=
self
.
_getUserIdList
([
self
.
accounting_agent_reference
])
self
.
failIfUserCanPassWorkflowTransition
(
accounting_agent_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
...
@@ -1333,62 +1350,62 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1333,62 +1350,62 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
start_date
=
DateTime
(
2001
,
01
,
01
),
start_date
=
DateTime
(
2001
,
01
,
01
),
stop_date
=
DateTime
(
2001
,
01
,
01
))
stop_date
=
DateTime
(
2001
,
01
,
01
))
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
-
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
-
self
.
sales_and_purchase_username_list
):
self
.
sales_and_purchase_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
# XXX would require to go to confirmed state first
# XXX would require to go to confirmed state first
# self.failIfUserCanPassWorkflowTransition(user
name
,
# self.failIfUserCanPassWorkflowTransition(user
_id
,
# 'start_action',
# 'start_action',
# transaction)
# transaction)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
# TODO
# TODO
### self.failUnlessUserCanPassWorkflowTransition(user
name
,
### self.failUnlessUserCanPassWorkflowTransition(user
_id
,
### 'delete_action',
### 'delete_action',
### transaction)
### transaction)
...
@@ -1397,55 +1414,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1397,55 +1414,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# only accountant can modify
# only accountant can modify
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
# only accountant can "stop"
# only accountant can "stop"
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
transaction
.
stop
()
transaction
.
stop
()
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# nobody can modify
# nobody can modify
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
# in started state, we can modify again, and go back to stopped state
# in started state, we can modify again, and go back to stopped state
...
@@ -1453,9 +1470,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1453,9 +1470,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
...
@@ -1464,11 +1481,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1464,11 +1481,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
# only accounting_manager can validate
# only accounting_manager can validate
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
accounting_manager_reference
,
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
failUnlessUserCanPassWorkflowTransition
(
accounting_manager_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
self
.
failIfUserCanPassWorkflowTransition
(
self
.
accounting_agent_reference
,
accounting_agent_id
,
=
self
.
_getUserIdList
([
self
.
accounting_agent_reference
])
self
.
failIfUserCanPassWorkflowTransition
(
accounting_agent_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
...
@@ -1478,47 +1497,47 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1478,47 +1497,47 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
start_date
=
DateTime
(
2001
,
01
,
01
),
start_date
=
DateTime
(
2001
,
01
,
01
),
stop_date
=
DateTime
(
2001
,
01
,
01
))
stop_date
=
DateTime
(
2001
,
01
,
01
))
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'draft'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'start_action'
,
'start_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'plan_action'
,
'plan_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'confirm_action'
,
'confirm_action'
,
transaction
)
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
# TODO
# TODO
### self.failUnlessUserCanPassWorkflowTransition(user
name
,
### self.failUnlessUserCanPassWorkflowTransition(user
_id
,
### 'delete_action',
### 'delete_action',
### transaction)
### transaction)
...
@@ -1527,55 +1546,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1527,55 +1546,55 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# only accountant can modify
# only accountant can modify
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
# only accountant can "stop"
# only accountant can "stop"
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
transaction
.
stop
()
transaction
.
stop
()
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
# everybody can view
# everybody can view
self
.
assertUserCanViewDocument
(
user
name
,
transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
transaction
)
# nobody can modify
# nobody can modify
self
.
failIfUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
name
,
transaction
)
self
.
failIfUserCanAddDocument
(
user
_id
,
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
for
user
name
in
(
self
.
all_username_list
-
self
.
accountant_username_list
):
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
-
self
.
accountant_username_list
):
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
self
.
failIfUserCanPassWorkflowTransition
(
user
name
,
self
.
failIfUserCanPassWorkflowTransition
(
user
_id
,
'cancel_action'
,
'cancel_action'
,
transaction
)
transaction
)
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'restart_action'
,
'restart_action'
,
transaction
)
transaction
)
# in started state, we can modify again, and go back to stopped state
# in started state, we can modify again, and go back to stopped state
...
@@ -1583,9 +1602,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1583,9 +1602,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'started'
,
transaction
.
getSimulationState
())
self
.
tic
()
self
.
tic
()
for
user
name
in
self
.
accountant_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
accountant_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
transaction
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
transaction
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'stop_action'
,
'stop_action'
,
transaction
)
transaction
)
...
@@ -1594,11 +1613,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1594,11 +1613,13 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
self
.
assertEqual
(
'stopped'
,
transaction
.
getSimulationState
())
# only accounting_manager can validate
# only accounting_manager can validate
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
accounting_manager_reference
,
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
failUnlessUserCanPassWorkflowTransition
(
accounting_manager_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
if
self
.
restricted_security
:
if
self
.
restricted_security
:
self
.
failIfUserCanPassWorkflowTransition
(
self
.
accounting_agent_reference
,
accounting_agent_id
,
=
self
.
_getUserIdList
([
self
.
accounting_agent_reference
])
self
.
failIfUserCanPassWorkflowTransition
(
accounting_agent_id
,
'deliver_action'
,
'deliver_action'
,
transaction
)
transaction
)
...
@@ -1607,13 +1628,14 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1607,13 +1628,14 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# done from unrestricted code, so no problem)
# done from unrestricted code, so no problem)
balance_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
balance_transaction
=
self
.
portal
.
accounting_module
.
newContent
(
portal_type
=
'Balance Transaction'
)
portal_type
=
'Balance Transaction'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
balance_transaction
)
self
.
assertUserCanViewDocument
(
user
_id
,
balance_transaction
)
self
.
assertUserCanAccessDocument
(
user
name
,
balance_transaction
)
self
.
assertUserCanAccessDocument
(
user
_id
,
balance_transaction
)
def
stepAccountingTransaction_getCausalityGroupedAccountingTransactionList
(
def
stepAccountingTransaction_getCausalityGroupedAccountingTransactionList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
_loginAsUser
(
self
.
accounting_manager_reference
)
accounting_manager_id
,
=
self
.
_getUserIdList
([
self
.
accounting_manager_reference
])
self
.
_loginAsUser
(
accounting_manager_id
)
accounting_transaction_x_related_to_a
=
self
.
portal
.
\
accounting_transaction_x_related_to_a
=
self
.
portal
.
\
accounting_module
.
newContent
(
accounting_module
.
newContent
(
portal_type
=
'Accounting Transaction'
,
portal_type
=
'Accounting Transaction'
,
...
@@ -1685,11 +1707,11 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1685,11 +1707,11 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
def
stepAddAssignments
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAddAssignments
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
# for now, anybody can add assignements
# for now, anybody can add assignements
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
assertTrue
(
'Assignment'
in
self
.
assertTrue
(
'Assignment'
in
person
.
getVisibleAllowedContentTypeList
())
person
.
getVisibleAllowedContentTypeList
())
self
.
failUnlessUserCanAddDocument
(
user
name
,
person
)
self
.
failUnlessUserCanAddDocument
(
user
_id
,
person
)
def
stepAssignmentTI
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepAssignmentTI
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
ti
=
self
.
getTypesTool
().
getTypeInfo
(
'Assignment'
)
ti
=
self
.
getTypesTool
().
getTypeInfo
(
'Assignment'
)
...
@@ -1701,9 +1723,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1701,9 +1723,9 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# everybody can open assignments in express
# everybody can open assignments in express
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
'Person'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
failUnlessUserCanModifyDocument
(
user
name
,
assignment
)
self
.
failUnlessUserCanModifyDocument
(
user
_id
,
assignment
)
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
self
.
failUnlessUserCanPassWorkflowTransition
(
user
_id
,
'open_action'
,
'open_action'
,
assignment
)
assignment
)
# }}}
# }}}
...
@@ -1711,106 +1733,106 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1711,106 +1733,106 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
# {{{ Trade
# {{{ Trade
def
stepViewAcessAddPurchaseTradeCondition
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAcessAddPurchaseTradeCondition
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
purchase_trade_condition_module
module
=
self
.
portal
.
purchase_trade_condition_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
tc
=
module
.
newContent
(
portal_type
=
'Purchase Trade Condition'
)
tc
=
module
.
newContent
(
portal_type
=
'Purchase Trade Condition'
)
self
.
assertUserCanViewDocument
(
user
name
,
tc
)
self
.
assertUserCanViewDocument
(
user
_id
,
tc
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'validate_action'
,
tc
)
user
_id
,
'validate_action'
,
tc
)
self
.
portal
.
portal_workflow
.
doActionFor
(
tc
,
'validate_action'
)
self
.
portal
.
portal_workflow
.
doActionFor
(
tc
,
'validate_action'
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'invalidate_action'
,
tc
)
user
_id
,
'invalidate_action'
,
tc
)
def
stepViewAccessAddSaleTradeCondition
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccessAddSaleTradeCondition
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
sale_trade_condition_module
module
=
self
.
portal
.
sale_trade_condition_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
tc
=
module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
tc
=
module
.
newContent
(
portal_type
=
'Sale Trade Condition'
)
self
.
assertUserCanViewDocument
(
user
name
,
tc
)
self
.
assertUserCanViewDocument
(
user
_id
,
tc
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'validate_action'
,
tc
)
user
_id
,
'validate_action'
,
tc
)
self
.
portal
.
portal_workflow
.
doActionFor
(
tc
,
'validate_action'
)
self
.
portal
.
portal_workflow
.
doActionFor
(
tc
,
'validate_action'
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'invalidate_action'
,
tc
)
user
_id
,
'invalidate_action'
,
tc
)
def
stepViewAccessAddSaleOrder
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccessAddSaleOrder
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
sale_order_module
module
=
self
.
portal
.
sale_order_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
order
=
module
.
newContent
(
portal_type
=
'Sale Order'
)
order
=
module
.
newContent
(
portal_type
=
'Sale Order'
)
self
.
assertUserCanViewDocument
(
user
name
,
order
)
self
.
assertUserCanViewDocument
(
user
_id
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'plan_action'
,
order
)
user
_id
,
'plan_action'
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'confirm_action'
,
order
)
user
_id
,
'confirm_action'
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'cancel_action'
,
order
)
user
_id
,
'cancel_action'
,
order
)
order
.
confirm
()
order
.
confirm
()
self
.
assertEqual
(
'confirmed'
,
order
.
getSimulationState
())
self
.
assertEqual
(
'confirmed'
,
order
.
getSimulationState
())
self
.
assertUserCanViewDocument
(
user
name
,
order
)
self
.
assertUserCanViewDocument
(
user
_id
,
order
)
self
.
failIfUserCanModifyDocument
(
user
name
,
order
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
order
)
def
stepViewAccessAddSalePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccessAddSalePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
sale_packing_list_module
module
=
self
.
portal
.
sale_packing_list_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
pl
=
module
.
newContent
(
portal_type
=
'Sale Packing List'
)
pl
=
module
.
newContent
(
portal_type
=
'Sale Packing List'
)
self
.
assertUserCanViewDocument
(
user
name
,
pl
)
self
.
assertUserCanViewDocument
(
user
_id
,
pl
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'confirm_action'
,
pl
)
user
_id
,
'confirm_action'
,
pl
)
def
stepViewAccessPurchaseOrder
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepViewAccessPurchaseOrder
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
purchase_order_module
module
=
self
.
portal
.
purchase_order_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
order
=
module
.
newContent
(
portal_type
=
'Purchase Order'
)
order
=
module
.
newContent
(
portal_type
=
'Purchase Order'
)
self
.
assertUserCanViewDocument
(
user
name
,
order
)
self
.
assertUserCanViewDocument
(
user
_id
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'plan_action'
,
order
)
user
_id
,
'plan_action'
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'confirm_action'
,
order
)
user
_id
,
'confirm_action'
,
order
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'cancel_action'
,
order
)
user
_id
,
'cancel_action'
,
order
)
order
.
confirm
()
order
.
confirm
()
self
.
assertEqual
(
'confirmed'
,
order
.
getSimulationState
())
self
.
assertEqual
(
'confirmed'
,
order
.
getSimulationState
())
self
.
assertUserCanViewDocument
(
user
name
,
order
)
self
.
assertUserCanViewDocument
(
user
_id
,
order
)
self
.
failIfUserCanModifyDocument
(
user
name
,
order
)
self
.
failIfUserCanModifyDocument
(
user
_id
,
order
)
def
stepPurchasePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
def
stepPurchasePackingList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
module
=
self
.
portal
.
purchase_packing_list_module
module
=
self
.
portal
.
purchase_packing_list_module
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
assertUserCanViewDocument
(
user
name
,
module
)
self
.
assertUserCanViewDocument
(
user
_id
,
module
)
self
.
assertUserCanAccessDocument
(
user
name
,
module
)
self
.
assertUserCanAccessDocument
(
user
_id
,
module
)
for
user
name
in
self
.
sales_and_purchase_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
sales_and_purchase_username_list
)
:
self
.
assertUserCanAddDocument
(
user
name
,
module
)
self
.
assertUserCanAddDocument
(
user
_id
,
module
)
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
pl
=
module
.
newContent
(
portal_type
=
'Purchase Packing List'
)
pl
=
module
.
newContent
(
portal_type
=
'Purchase Packing List'
)
self
.
assertUserCanViewDocument
(
user
name
,
pl
)
self
.
assertUserCanViewDocument
(
user
_id
,
pl
)
self
.
failUnlessUserCanPassWorkflowTransition
(
self
.
failUnlessUserCanPassWorkflowTransition
(
user
name
,
'confirm_action'
,
pl
)
user
_id
,
'confirm_action'
,
pl
)
# }}}
# }}}
# web
# web
...
@@ -1832,7 +1854,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
...
@@ -1832,7 +1854,7 @@ class TestLiveConfiguratorWorkflowMixin(SecurityTestCase):
"""
"""
portal_contributions
=
self
.
portal
.
portal_contributions
portal_contributions
=
self
.
portal
.
portal_contributions
checkPermission
=
self
.
portal
.
portal_membership
.
checkPermission
checkPermission
=
self
.
portal
.
portal_membership
.
checkPermission
for
user
name
in
self
.
all_username_list
:
for
user
_id
in
self
.
_getUserIdList
(
self
.
all_username_list
)
:
self
.
_loginAsUser
(
user
name
)
self
.
_loginAsUser
(
user
_id
)
self
.
assertEqual
(
True
,
\
self
.
assertEqual
(
True
,
\
checkPermission
(
'Modify portal content'
,
portal_contributions
))
checkPermission
(
'Modify portal content'
,
portal_contributions
))
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