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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
da6218c8
Commit
da6218c8
authored
Nov 23, 2021
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core_test: add career constraint test
parent
5165f145
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
...tTemplateItem/portal_components/test.erp5.testERP5Base.py
+36
-0
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Base.py
View file @
da6218c8
...
...
@@ -61,6 +61,8 @@ class TestERP5Base(ERP5TypeTestCase):
self
.
portal_catalog
=
self
.
getCatalogTool
()
self
.
portal_preferences
=
self
.
getPreferenceTool
()
self
.
createCategories
()
self
.
_addPropertySheet
(
'Career'
,
'CareerConstraint'
)
self
.
commit
()
def
beforeTearDown
(
self
):
self
.
abort
()
...
...
@@ -979,6 +981,40 @@ class TestERP5Base(ERP5TypeTestCase):
age_as_text
=
person
.
Person_getAge
(
at_date
=
DateTime
(
2002
,
2
,
4
))
self
.
assertEqual
(
age_as_text
,
"1 years old"
)
def
test_career_constraint
(
self
):
organisation
=
self
.
getOrganisationModule
().
newContent
(
portal_type
=
'Organisation'
)
person
=
self
.
getPersonModule
().
newContent
(
portal_type
=
'Person'
,
default_career_subordination_value
=
organisation
)
self
.
tic
()
current_career
=
person
.
getDefaultCareerValue
()
message_list
=
current_career
.
checkConsistency
()
self
.
assertEqual
(
len
(
message_list
),
0
)
self
.
portal_preferences
.
default_site_preference
.
setPreferredSectionCategory
(
'group/nexedi'
)
if
self
.
portal_preferences
.
default_site_preference
.
getPreferenceState
()
==
"disabled"
:
self
.
portal_preferences
.
default_site_preference
.
enable
()
organisation
.
setGroup
(
'nexedi'
)
self
.
tic
()
message_list
=
current_career
.
checkConsistency
()
self
.
assertEqual
(
len
(
message_list
),
1
)
self
.
assertEqual
(
str
(
message_list
[
0
].
getMessage
()),
'Employee Number is not defined'
)
self
.
tic
()
current_career
.
Career_setEmployeeNumber
(
batch
=
1
)
message_list
=
current_career
.
checkConsistency
()
self
.
assertEqual
(
len
(
message_list
),
0
)
current_career
.
start
()
self
.
tic
()
new_career
=
person
.
newContent
(
portal_type
=
'Career'
,
subordination_value
=
organisation
)
new_career
.
Career_setEmployeeNumber
(
batch
=
1
,
employee_number
=
current_career
.
getReference
())
self
.
tic
()
message_list
=
new_career
.
checkConsistency
()
self
.
assertEqual
(
len
(
message_list
),
1
)
self
.
assertEqual
(
str
(
message_list
[
0
].
getMessage
()),
'There already is a started career with the same employee number'
)
new_career
.
Career_setEmployeeNumber
(
batch
=
1
,
force
=
1
)
self
.
tic
()
message_list
=
new_career
.
checkConsistency
()
self
.
assertEqual
(
len
(
message_list
),
0
)
def
test_AssignmentWorkflow
(
self
):
person
=
self
.
getPersonModule
().
newContent
(
portal_type
=
'Person'
,)
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
...
...
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