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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Georgios Dagkakis
erp5
Commits
5fcf7ef6
Commit
5fcf7ef6
authored
Mar 16, 2023
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_credential: Test create assignment w/o start/stop date
parent
5c7db280
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
0 deletions
+63
-0
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.testERP5Credential.py
...ateItem/portal_components/test.erp5.testERP5Credential.py
+63
-0
No files found.
bt5/erp5_credential/TestTemplateItem/portal_components/test.erp5.testERP5Credential.py
View file @
5fcf7ef6
...
@@ -263,6 +263,18 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -263,6 +263,18 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
self
.
logout
()
self
.
logout
()
def
stepSetCredentialAssignmentDurationProperty
(
self
,
sequence
=
None
):
if
sequence
is
None
:
sequence
=
{}
assignment_duration
=
sequence
.
get
(
"assignment_duration"
,
20
)
self
.
login
()
preference
=
self
.
_getPreference
()
preference
.
edit
(
preferred_credential_assignment_duration
=
assignment_duration
)
self
.
_enablePreference
()
self
.
tic
()
self
.
logout
()
def
stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences
(
self
,
def
stepSetOrganisationCredentialUpdateAutomaticApprovalPreferences
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
self
.
login
()
self
.
login
()
...
@@ -311,6 +323,27 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -311,6 +323,27 @@ class TestERP5Credential(ERP5TypeTestCase):
self
.
assertEqual
(
assignment
.
getFunction
(),
assignment_function
)
self
.
assertEqual
(
assignment
.
getFunction
(),
assignment_function
)
self
.
assertEqual
(
assignment
.
getRole
(),
assignment_role
)
self
.
assertEqual
(
assignment
.
getRole
(),
assignment_role
)
def
stepCheckAssignmentWithoutStopDate
(
self
,
sequence
):
reference
=
sequence
[
"reference"
]
person
=
self
.
portal
.
acl_users
.
getUser
(
reference
).
getUserValue
()
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
assignment
=
assignment_list
[
0
]
self
.
assertEqual
(
assignment
.
getStartDate
(),
None
)
self
.
assertEqual
(
assignment
.
getStopDate
(),
None
)
def
stepCheckAssignmentWithStopDate
(
self
,
sequence
):
reference
=
sequence
[
"reference"
]
person
=
self
.
portal
.
acl_users
.
getUser
(
reference
).
getUserValue
()
assignment_list
=
person
.
objectValues
(
portal_type
=
"Assignment"
)
self
.
assertEqual
(
len
(
assignment_list
),
1
)
assignment
=
assignment_list
[
0
]
self
.
assertNotEqual
(
assignment
.
getStartDate
(),
None
)
self
.
assertTrue
(
assignment
.
getStartDate
()
<
DateTime
())
assignment_duration
=
sequence
[
'assignment_duration'
]
self
.
assertTrue
(
assignment
.
getStopDate
()
<
DateTime
()
+
assignment_duration
)
self
.
assertTrue
(
assignment
.
getStopDate
()
>
DateTime
()
+
assignment_duration
-
1
)
def
getUserFolder
(
self
):
def
getUserFolder
(
self
):
"""Returns the acl_users. """
"""Returns the acl_users. """
return
self
.
getPortal
().
acl_users
return
self
.
getPortal
().
acl_users
...
@@ -1096,6 +1129,36 @@ class TestERP5Credential(ERP5TypeTestCase):
...
@@ -1096,6 +1129,36 @@ class TestERP5Credential(ERP5TypeTestCase):
assignment_role="
client
")
assignment_role="
client
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
self.stepCheckAssignmentAfterActiveLogin(sequence)
def testAssignmentCreationUsingSystemPreferenceDurationProperty(self):
"""
Check that the category list are used correctly to create a new
assignment
"""
sequence = dict(automatic_call=False)
self.stepSetCredentialRequestAutomaticApprovalPreferences(sequence)
self.stepSetCredentialAssignmentPropertyList()
self.stepSetCredentialAssignmentDurationProperty(
dict(assignment_duration=0))
self._createCredentialRequest()
sequence = dict(reference="
barney
",
assignment_function="
member
",
assignment_role="
internal
")
self.stepCheckAssignmentAfterActiveLogin(sequence)
self.stepCheckAssignmentWithoutStopDate(sequence)
category_list = ["
role
/
client
", "
function
/
agent
"]
self.stepSetCredentialAssignmentPropertyList(
dict(category_list=category_list))
assignment_duration = 20
self.stepSetCredentialAssignmentDurationProperty(
dict(assignment_duration=assignment_duration))
self._createCredentialRequest(reference="
credential_user
")
sequence = dict(reference="
credential_user
",
assignment_function="
agent
",
assignment_role="
client
",
assignment_duration=assignment_duration)
self.stepCheckAssignmentAfterActiveLogin(sequence)
self.stepCheckAssignmentWithStopDate(sequence)
def testERP5Site_activeLogin(self):
def testERP5Site_activeLogin(self):
"""
"""
Test if the script WebSection_activeLogin will create one user
Test if the script WebSection_activeLogin will create one user
...
...
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