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
a968e108
Commit
a968e108
authored
Jun 24, 2016
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testCalender: Add a test for Presence Request portal type.
parent
09e4cdf3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
0 deletions
+121
-0
product/ERP5/tests/testCalendar.py
product/ERP5/tests/testCalendar.py
+121
-0
No files found.
product/ERP5/tests/testCalendar.py
View file @
a968e108
...
@@ -40,8 +40,10 @@ class TestCalendar(ERP5ReportTestCase):
...
@@ -40,8 +40,10 @@ class TestCalendar(ERP5ReportTestCase):
person_portal_type
=
"Person"
person_portal_type
=
"Person"
group_calendar_portal_type
=
"Group Calendar"
group_calendar_portal_type
=
"Group Calendar"
leave_request_portal_type
=
"Leave Request"
leave_request_portal_type
=
"Leave Request"
presence_request_portal_type
=
"Presence Request"
group_presence_period_portal_type
=
"Group Presence Period"
group_presence_period_portal_type
=
"Group Presence Period"
leave_request_period_portal_type
=
"Leave Request Period"
leave_request_period_portal_type
=
"Leave Request Period"
presence_request_period_portal_type
=
"Presence Request Period"
start_date
=
DateTime
(
DateTime
().
ISO8601
())
start_date
=
DateTime
(
DateTime
().
ISO8601
())
stop_date
=
start_date
+
0.5
stop_date
=
start_date
+
0.5
middle_date
=
start_date
+
0.25
middle_date
=
start_date
+
0.25
...
@@ -394,6 +396,95 @@ class TestCalendar(ERP5ReportTestCase):
...
@@ -394,6 +396,95 @@ class TestCalendar(ERP5ReportTestCase):
# self.assertEqual(len(obj_to_check.getDatePeriodList()),
# self.assertEqual(len(obj_to_check.getDatePeriodList()),
# uid_list.count(obj_to_check.getUid()))
# uid_list.count(obj_to_check.getUid()))
def
stepCreatePresenceRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Create a personal calendar
"""
portal
=
self
.
getPortal
()
module
=
portal
.
getDefaultModule
(
self
.
presence_request_portal_type
)
pc
=
module
.
newContent
(
portal_type
=
self
.
presence_request_portal_type
)
sequence
.
edit
(
presence_request
=
pc
,
)
def
stepSetPresenceRequestDestination
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set the destination
"""
presence_request
=
sequence
.
get
(
'presence_request'
)
person
=
sequence
.
get
(
'person'
)
presence_request
.
setDestinationValue
(
person
)
def
stepCreatePersonalPresencePeriod
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Create an personal calendar period
"""
presence_request
=
sequence
.
get
(
'presence_request'
)
personal_presence_period
=
presence_request
.
newContent
(
portal_type
=
self
.
presence_request_period_portal_type
,
resource_value
=
self
.
portal
.
service_module
.
consulting_service
)
sequence
.
edit
(
personal_presence_period
=
personal_presence_period
,
)
def
stepSetPersonalPresencePeriodToCheck
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set personal presence period to check
"""
personal_presence_period
=
sequence
.
get
(
'personal_presence_period'
)
sequence
.
edit
(
obj_to_check
=
personal_presence_period
)
def
stepSetPersonalPresencePeriodValues
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set values on personal calendar event
"""
personal_presence_period
=
sequence
.
get
(
'personal_presence_period'
)
def
stepSetPersonalPresencePeriodDates
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set values on personal calendar
"""
personal_presence_period
=
sequence
.
get
(
'personal_presence_period'
)
personal_presence_period
.
edit
(
start_date
=
self
.
start_date
,
stop_date
=
self
.
stop_date
,
)
def
stepSetPersonalPresencePeriodPerStopDate
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Set values on personal calendar event
"""
personal_presence_period
=
sequence
.
get
(
'personal_presence_period'
)
personal_presence_period
.
edit
(
periodicity_stop_date
=
self
.
periodicity_stop_date
,
)
def
stepPlanPresenceRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Plan personal calendar
"""
presence_request
=
sequence
.
get
(
'presence_request'
)
presence_request
.
plan
()
self
.
assertEqual
(
'planned'
,
presence_request
.
getSimulationState
())
def
stepConfirmPresenceRequest
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Confirm personal calendar
"""
presence_request
=
sequence
.
get
(
'presence_request'
)
presence_request
.
confirm
()
self
.
assertEqual
(
'confirmed'
,
presence_request
.
getSimulationState
())
def
test_01_CatalogCalendarPeriod
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
test_01_CatalogCalendarPeriod
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
"""
Test indexing
Test indexing
...
@@ -453,6 +544,36 @@ class TestCalendar(ERP5ReportTestCase):
...
@@ -453,6 +544,36 @@ class TestCalendar(ERP5ReportTestCase):
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
sequence_list
.
play
(
self
)
def
test_CatalogPresenceRequest
(
self
,
quiet
=
0
,
run
=
run_all_test
):
"""
Test indexing
"""
if
not
run
:
return
sequence_list
=
SequenceList
()
sequence_string
=
'''
CreatePerson
CreateLeaveRequest
SetLeaveRequestDestination
CreatePersonalLeavePeriod
SetPersonalLeavePeriodValues
Tic
SetPersonalLeavePeriodToCheck
CheckNotCatalogued
PlanLeaveRequest
ConfirmLeaveRequest
Tic
CheckNotCatalogued
SetPersonalLeavePeriodDates
Tic
CheckCatalogued
SetPersonalLeavePeriodPerStopDate
Tic
CheckCatalogued
'''
sequence_list
.
addSequenceString
(
sequence_string
)
sequence_list
.
play
(
self
)
def
stepCheckGetTimeAvailability
(
self
,
sequence
=
None
,
def
stepCheckGetTimeAvailability
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
sequence_list
=
None
,
**
kw
):
"""
"""
...
...
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