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
Xiaowu Zhang
erp5
Commits
36f719f0
Commit
36f719f0
authored
Nov 04, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_hr_test: add position opportunity tests
parent
622e8567
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
84 additions
and
0 deletions
+84
-0
bt5/erp5_hr_test/TestTemplateItem/portal_components/test.erp5.testPosition.py
...tTemplateItem/portal_components/test.erp5.testPosition.py
+84
-0
No files found.
bt5/erp5_hr_test/TestTemplateItem/portal_components/test.erp5.testPosition.py
View file @
36f719f0
...
...
@@ -128,3 +128,87 @@ class testPosition(ERP5TypeTestCase):
pdf
=
position_application
.
getFollowUpRelatedValue
(
portal_type
=
'PDF'
)
self
.
assertTrue
(
'Resume/CV, Generated by Writer'
in
pdf
.
getDescription
())
def
test_positionOpportunityFastInput
(
self
):
portal
=
self
.
getPortalObject
()
if
not
portal
.
service_module
.
has_key
(
'test_position_opportunity'
):
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
,
id
=
'test_position_opportunity'
,
reference
=
'test_position_opportunity'
,
title
=
'test position opportunity'
)
service
=
portal
.
service_module
.
test_position_opportunity
if
not
portal
.
service_module
.
has_key
(
'test_position_opportunity_2'
):
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
,
id
=
'test_position_opportunity_2'
,
reference
=
'test_position_opportunity_2'
,
title
=
'test position opportunity 2'
)
service_2
=
portal
.
service_module
.
test_position_opportunity_2
position_opportunity
=
portal
.
position_opportunity_module
.
newContent
(
portal_type
=
'Position Opportunity'
)
position_requirement
=
position_opportunity
.
newContent
(
portal_type
=
'Position Requirement'
)
for
item
in
[
position_opportunity
,
position_requirement
]:
position_requirement_dict
=
item
.
PositionOpporunity_addFastInputLineList
(
listbox
=
({
'listbox_key'
:
'1'
,
'price'
:
123
,
'resource_relative_url'
:
service
.
getRelativeUrl
(),
'reference'
:
service
.
getReference
(),
'title'
:
service
.
getTitle
()},),
batch
=
1
)
self
.
assertEqual
(
len
(
position_requirement_dict
.
keys
()),
1
)
self
.
assertTrue
(
service
.
getRelativeUrl
()
in
position_requirement_dict
)
position_requirement
=
position_requirement_dict
[
service
.
getRelativeUrl
()]
self
.
assertEqual
(
position_requirement
.
getTitle
(),
service
.
getTitle
())
self
.
assertEqual
(
position_requirement
.
getReference
(),
service
.
getReference
())
self
.
assertEqual
(
position_requirement
.
getPrice
(),
123
)
# only one for same service
position_requirement_dict
=
item
.
PositionOpporunity_addFastInputLineList
(
listbox
=
({
'listbox_key'
:
'1'
,
'price'
:
123
,
'resource_relative_url'
:
service
.
getRelativeUrl
(),
'reference'
:
service
.
getReference
(),
'title'
:
service
.
getTitle
()},
{
'listbox_key'
:
'2'
,
'price'
:
456
,
'resource_relative_url'
:
service
.
getRelativeUrl
(),
'reference'
:
service
.
getReference
(),
'title'
:
service
.
getTitle
()}),
batch
=
1
)
self
.
assertEqual
(
len
(
position_requirement_dict
.
keys
()),
1
)
self
.
assertTrue
(
service
.
getRelativeUrl
()
in
position_requirement_dict
)
position_requirement
=
position_requirement_dict
[
service
.
getRelativeUrl
()]
self
.
assertEqual
(
position_requirement
.
getTitle
(),
service
.
getTitle
())
self
.
assertEqual
(
position_requirement
.
getReference
(),
service
.
getReference
())
self
.
assertEqual
(
position_requirement
.
getPrice
(),
123
)
position_requirement_dict
=
item
.
PositionOpporunity_addFastInputLineList
(
listbox
=
({
'listbox_key'
:
'1'
,
'price'
:
123
,
'resource_relative_url'
:
service
.
getRelativeUrl
(),
'reference'
:
service
.
getReference
(),
'title'
:
service
.
getTitle
()},
{
'listbox_key'
:
'2'
,
'price'
:
123
,
'resource_relative_url'
:
service_2
.
getRelativeUrl
(),
'reference'
:
service_2
.
getReference
(),
'title'
:
service_2
.
getTitle
()}),
batch
=
1
)
self
.
assertEqual
(
len
(
position_requirement_dict
.
keys
()),
2
)
for
i
in
[
service
,
service_2
]:
self
.
assertTrue
(
i
.
getRelativeUrl
()
in
position_requirement_dict
)
position_requirement
=
position_requirement_dict
[
i
.
getRelativeUrl
()]
self
.
assertEqual
(
position_requirement
.
getTitle
(),
i
.
getTitle
())
self
.
assertEqual
(
position_requirement
.
getReference
(),
i
.
getReference
())
self
.
assertEqual
(
position_requirement
.
getPrice
(),
123
)
def
test_positionOpportunityGetFastInputLine
(
self
):
portal
=
self
.
getPortalObject
()
position_opportunity
=
portal
.
position_opportunity_module
.
newContent
(
portal_type
=
'Position Opportunity'
)
lines_num
=
5
result_list
=
position_opportunity
.
PositionOpportunity_getFastInputLineList
(
lines_num
)
self
.
assertEqual
(
len
(
result_list
),
lines_num
)
portal
.
REQUEST
.
form
[
'field_listbox_title_new_1'
]
=
'service_1'
result_list
=
position_opportunity
.
PositionOpportunity_getFastInputLineList
(
lines_num
)
self
.
assertEqual
(
len
(
result_list
),
lines_num
+
1
)
self
.
assertEqual
(
result_list
[
0
].
resource_title
,
'service_1'
)
def
test_positionOpportunityUpdateFastInputLine
(
self
):
portal
=
self
.
getPortalObject
()
position_opportunity
=
portal
.
position_opportunity_module
.
newContent
(
portal_type
=
'Position Opportunity'
)
if
not
portal
.
service_module
.
has_key
(
'test_position_opportunity'
):
portal
.
service_module
.
newContent
(
portal_type
=
'Service'
,
id
=
'test_position_opportunity'
,
reference
=
'test_position_opportunity'
,
title
=
'test position opportunity'
)
service
=
portal
.
service_module
.
test_position_opportunity
listbox
=
({
'listbox_key'
:
'1'
,
'price'
:
123
,
'resource_relative_url'
:
''
,
'reference'
:
service
.
getReference
(),
'title'
:
service
.
getTitle
()},)
output_listbox
=
position_opportunity
.
PositionOpporunity_updateFastInputLineList
(
listbox
,
batch
=
1
)
listbox
[
0
][
'resource_relative_url'
]
=
service
.
getReference
()
self
.
assertEqual
(
output_listbox
,
listbox
)
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