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
1
Issues
1
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
Roque
erp5
Commits
918109bc
Commit
918109bc
authored
Apr 03, 2012
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Included tests for Alarm Configurator Item
parent
5368dcfc
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
6 deletions
+73
-6
bt5/erp5_configurator_standard/TestTemplateItem/testStandardConfigurationWorkflow.py
...ard/TestTemplateItem/testStandardConfigurationWorkflow.py
+15
-0
product/ERP5Configurator/Document/AlarmConfiguratorItem.py
product/ERP5Configurator/Document/AlarmConfiguratorItem.py
+5
-6
product/ERP5Configurator/tests/testConfiguratorItem.py
product/ERP5Configurator/tests/testConfiguratorItem.py
+53
-0
No files found.
bt5/erp5_configurator_standard/TestTemplateItem/testStandardConfigurationWorkflow.py
View file @
918109bc
...
...
@@ -50,6 +50,7 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
stepCheckPersonInformationList
stepCheckValidOrganisationList
stepCheckValidCurrencyList
stepCheckAlarmList
stepCheckPublicGadgetList
stepCheckPreferenceList
stepCheckModulesBusinessApplication
...
...
@@ -285,6 +286,20 @@ class StandardConfigurationMixin(TestLiveConfiguratorWorkflowMixin):
# self.assertEquals('validated', currency.getValidationState())
currency
.
Base_checkConsistency
()
def
stepCheckAlarmList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Check if after configuration the Alarms objects are enabled.
"""
business_configuration
=
sequence
.
get
(
"business_configuration"
)
alarm_list
=
self
.
getBusinessConfigurationObjectList
(
business_configuration
,
'Alarm'
)
self
.
assertEquals
(
len
(
alarm_list
),
2
)
for
alarm
in
alarm_list
:
self
.
failUnless
(
alarm
.
getPeriodicityStartDate
()
<
DateTime
())
self
.
assertNotEquals
(
alarm
.
getPeriodicityStartDate
(),
None
)
self
.
assertEquals
(
alarm
.
getPeriodicityMinuteFrequency
(),
5
)
self
.
assertEquals
(
alarm
.
getEnabled
(),
True
)
self
.
assertNotEquals
(
alarm
.
getActiveSenseMethodId
(),
None
)
def
stepCheckPublicGadgetList
(
self
,
sequence
=
None
,
sequence_list
=
None
,
**
kw
):
"""
Assert all gadgets are publics.
...
...
product/ERP5Configurator/Document/AlarmConfiguratorItem.py
View file @
918109bc
...
...
@@ -62,15 +62,14 @@ class AlarmConfiguratorItem(ConfiguratorItemMixin, XMLObject):
portal_alarms
=
self
.
getPortalObject
().
portal_alarms
property_dict
=
{
"active_sense_method_id"
:
self
.
getActiveSenseMethodId
(),
"periodicity_minute_frequency"
:
self
.
getPeriodicityMinuteFrequency
(),
"periodicity_hour"
:
self
.
getPeriodicityHour
(),
"periodicity_minute"
:
self
.
getPeriodicityMinute
(),
"periodicity_hour_list"
:
self
.
getPeriodicityHourList
(),
"periodicity_minute_list"
:
self
.
getPeriodicityMinuteList
(),
"periodicity_minute_frequency"
:
self
.
getPeriodicityMinuteFrequency
(),
"periodicity_month
"
:
self
.
getPeriodicityMonth
(),
"periodicity_month_day
"
:
self
.
getPeriodicityMonthDay
(),
"periodicity_month
_list"
:
self
.
getPeriodicityMonthList
(),
"periodicity_month_day
_list"
:
self
.
getPeriodicityMonthDayList
(),
"periodicity_start_date"
:
DateTime
()
-
1
,
#"periodicity_stop_date": self.getPeriodicityStopDate(),
"periodicity_week
"
:
self
.
getPeriodicityWeek
(),
"periodicity_week
_list"
:
self
.
getPeriodicityWeekList
(),
}
alarm
=
getattr
(
portal_alarms
,
self
.
getId
(),
None
)
...
...
product/ERP5Configurator/tests/testConfiguratorItem.py
View file @
918109bc
...
...
@@ -29,6 +29,8 @@
from
AccessControl
import
Unauthorized
from
zLOG
import
LOG
,
INFO
import
uuid
from
DateTime
import
DateTime
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Configurator.tests.ConfiguratorTestMixin
import
\
TestLiveConfiguratorWorkflowMixin
...
...
@@ -247,6 +249,57 @@ class TestConfiguratorItem(TestLiveConfiguratorWorkflowMixin):
self
.
assertNotEquals
(
None
,
security_script
)
self
.
assertEquals
(
security_script
(),
expect_script_outcome
)
def
testAlarmConfiguratorItem
(
self
):
""" Test Alarm Configurator Item """
configuration_save
=
self
.
createConfigurationSave
()
bc
=
configuration_save
.
getParentValue
()
property_map
=
{
"active_sense_method_id"
:
"Base_setDummy"
,
"periodicity_hour_list"
:
[
5
,
6
],
"periodicity_minute_list"
:
[
30
,
31
],
"periodicity_minute_frequency"
:
5
,
"periodicity_month_list"
:
[
1
,
2
],
"periodicity_month_day_list"
:
[
3
,
4
],
"periodicity_week_list"
:
[
6
,
7
],
}
item
=
configuration_save
.
addConfigurationItem
(
"Alarm Configurator Item"
,
id
=
"my_test_alarm"
,
title
=
"My Test Alarm"
,
**
property_map
)
createZODBPythonScript
(
self
.
getPortal
().
portal_skins
.
custom
,
property_map
[
"active_sense_method_id"
],
""
,
"context.setEnabled(0)"
)
self
.
stepTic
()
item
.
_build
(
bc
)
self
.
stepTic
()
alarm
=
getattr
(
self
.
portal
.
portal_alarms
,
"my_test_alarm"
,
None
)
self
.
assertNotEquals
(
None
,
alarm
)
self
.
assertEquals
(
alarm
.
getEnabled
(),
True
)
self
.
assertEquals
(
alarm
.
getTitle
(),
"My Test Alarm"
)
self
.
assertEquals
(
alarm
.
getPeriodicityMinuteFrequency
(),
property_map
[
"periodicity_minute_frequency"
])
self
.
assertEquals
(
alarm
.
getPeriodicityMonthList
(),
property_map
[
"periodicity_month_list"
])
self
.
assertEquals
(
alarm
.
getPeriodicityMonthDayList
(),
property_map
[
"periodicity_month_day_list"
])
self
.
assertEquals
(
alarm
.
getPeriodicityHourList
(),
property_map
[
"periodicity_hour_list"
])
self
.
assertEquals
(
alarm
.
getPeriodicityHourList
(),
property_map
[
"periodicity_hour_list"
])
self
.
assertEquals
(
alarm
.
getActiveSenseMethodId
(),
property_map
[
"active_sense_method_id"
])
self
.
assertNotEquals
(
alarm
.
getPeriodicityStartDate
(),
None
)
self
.
failUnless
(
alarm
.
getPeriodicityStartDate
()
<
DateTime
())
alarm
.
activeSense
()
self
.
stepTic
()
self
.
assertEquals
(
alarm
.
getEnabled
(),
0
)
def
testPortalTypeRolesSpreadsheetConfiguratorItem
(
self
):
""" Test Portal Type Roles Configurator Item """
configuration_save
=
self
.
createConfigurationSave
()
...
...
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