Commit 8266ae4c authored by Rafael Monnerat's avatar Rafael Monnerat

Added check for Restart Action.

Added check for Price Currency is copy from task to task report using simulation.
Commented Login part and use the general one.

Changes made by Lucas.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21076 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 117f1c07
...@@ -63,7 +63,9 @@ class TestTaskMixin: ...@@ -63,7 +63,9 @@ class TestTaskMixin:
stepCreateProject \ stepCreateProject \
stepCreateRequirement \ stepCreateRequirement \
stepCreateSimpleTask \ stepCreateSimpleTask \
stepCreateCurrency \
stepFillTaskWithData \ stepFillTaskWithData \
stepSetTaskPriceCurrency \
stepConfirmTask \ stepConfirmTask \
stepTic \ stepTic \
stepSetTaskReport ' stepSetTaskReport '
...@@ -76,7 +78,9 @@ class TestTaskMixin: ...@@ -76,7 +78,9 @@ class TestTaskMixin:
stepCreateResource \ stepCreateResource \
stepCreateProject \ stepCreateProject \
stepCreateSimpleTask \ stepCreateSimpleTask \
stepCreateCurrency \
stepFillTaskWithData \ stepFillTaskWithData \
stepSetTaskPriceCurrency \
stepCreateTaskLine \ stepCreateTaskLine \
stepFillTaskLineWithData \ stepFillTaskLineWithData \
stepConfirmTask \ stepConfirmTask \
...@@ -89,7 +93,9 @@ class TestTaskMixin: ...@@ -89,7 +93,9 @@ class TestTaskMixin:
stepCreateOrganisation \ stepCreateOrganisation \
stepCreateResource \ stepCreateResource \
stepCreateSimpleTaskReport \ stepCreateSimpleTaskReport \
stepCreateCurrency \
stepFillTaskReportWithData \ stepFillTaskReportWithData \
stepSetTaskReportPriceCurrency \
stepCreateTaskReportLine ' stepCreateTaskReportLine '
login = PortalTestCase.login login = PortalTestCase.login
...@@ -99,49 +105,57 @@ class TestTaskMixin: ...@@ -99,49 +105,57 @@ class TestTaskMixin:
""" """
return ('erp5_base','erp5_pdm', 'erp5_trade', 'erp5_project',) return ('erp5_base','erp5_pdm', 'erp5_trade', 'erp5_project',)
def stepLogin(self, **kw): # def stepLogin(self, **kw):
portal = self.getPortal() # portal = self.getPortal()
uf = portal.acl_users # uf = portal.acl_users
if not uf.getUser('dummy'): # if not uf.getUser('dummy'):
uf._doAddUser('manager', '', ['Manager'], []) # uf._doAddUser('manager', '', ['Manager'], [])
self.login('manager') # self.login('manager')
person_module = portal.getDefaultModule(self.person_portal_type) # person_module = portal.getDefaultModule(self.person_portal_type)
person = person_module.newContent(id='dummy', title='dummy', # person = person_module.newContent(id='dummy', title='dummy',
reference='dummy') # reference='dummy')
portal.portal_categories.group.newContent(id='dummy', # portal.portal_categories.group.newContent(id='dummy',
codification='DUMMY') # codification='DUMMY')
assignment = person.newContent(title='dummy', group='dummy', #
portal_type='Assignment', # assignment = person.newContent(title='dummy', group='dummy',
start_date='1980-01-01', # portal_type='Assignment',
stop_date='2099-12-31') # start_date='1980-01-01',
assignment.open() # stop_date='2099-12-31')
get_transaction().commit() # assignment.open()
self.tic() # get_transaction().commit()
module_list = [] # self.tic()
portal_type_list = [] # module_list = []
for portal_type in (self.resource_portal_type, # portal_type_list = []
self.project_portal_type, # for portal_type in (self.resource_portal_type,
self.requirement_document_portal_type, # self.project_portal_type,
self.organisation_portal_type, # self.requirement_document_portal_type,
self.task_portal_type, # self.organisation_portal_type,
self.task_report_portal_type,): # self.task_portal_type,
module = portal.getDefaultModule(portal_type) # self.task_report_portal_type,
module_list.append(module) # self.category_portal_type,):
portal_type_list.append(portal_type) # module = portal.getDefaultModule(portal_type)
portal_type_list.append(module.getPortalType()) # module_list.append(module)
# portal_type_list.append(portal_type)
for portal_type in portal_type_list: # portal_type_list.append(module.getPortalType())
ti = portal.portal_types[portal_type] #
ti.addRole('Auditor;Author;Assignee;Assignor', '', 'Dummy', # for portal_type in portal_type_list:
'', 'group/dummy', 'ERP5Type_getSecurityCategoryFromAssignment', # ti = portal.portal_types[portal_type]
'') # ti.addRole('Auditor;Author;Assignee;Assignor', '', 'Dummy',
ti.updateRoleMapping() # '', 'group/dummy', 'ERP5Type_getSecurityCategoryFromAssignment',
# '')
get_transaction().commit() # ti.updateRoleMapping()
self.tic() #
portal.portal_caches.clearAllCache() # get_transaction().commit()
# self.tic()
self.login('dummy') # portal.portal_caches.clearAllCache()
#
# self.login('dummy')
def stepLogin(self, quiet=0, run=1, **kw):
uf = self.getPortal().acl_users
uf._doAddUser('alex', '', ['Manager', 'Assignee', 'Assignor',
'Associate', 'Auditor', 'Author'], [])
user = uf.getUserById('alex').__of__(uf)
newSecurityManager(None, user)
def stepTic(self, **kw): def stepTic(self, **kw):
self.tic() self.tic()
...@@ -220,6 +234,30 @@ class TestTaskMixin: ...@@ -220,6 +234,30 @@ class TestTaskMixin:
) )
sequence.edit(task=task) sequence.edit(task=task)
def stepCreateCurrency(self, sequence, **kw) :
"""Create a default currency. """
currency_module = self.getCurrencyModule()
if len(currency_module.objectValues(id='EUR'))==0:
currency = self.getCurrencyModule().newContent(
portal_type='Currency',
id="EUR",
base_unit_quantity=0.01,
)
else:
currency = currency_module.objectValues(id='EUR')[0]
sequence.edit(currency=currency)
def stepSetTaskPriceCurrency(self, sequence, **kw) :
"""Set the price currency of the task.
This step is not necessary.
TODO : - include a test without this step.
- include a test with this step late.
"""
currency = sequence.get('currency')
task = sequence.get('task')
task.setPriceCurrency(currency.getRelativeUrl())
def stepSetTaskValues(self, sequence=None, sequence_list=None, **kw): def stepSetTaskValues(self, sequence=None, sequence_list=None, **kw):
""" """
Fill created task with some necessary data. Fill created task with some necessary data.
...@@ -287,6 +325,17 @@ class TestTaskMixin: ...@@ -287,6 +325,17 @@ class TestTaskMixin:
stop_date = self.datetime + 20,) stop_date = self.datetime + 20,)
sequence.edit( task_report = task_report) sequence.edit( task_report = task_report)
def stepSetTaskReportPriceCurrency(self, sequence, **kw) :
"""Set the price currency of the task.
This step is not necessary.
TODO : - include a test without this step.
- include a test with this step late.
"""
currency = sequence.get('currency')
task_report = sequence.get('task_report')
task_report.setPriceCurrency(currency.getRelativeUrl())
def stepCreateTaskReportLine(self, sequence=None, sequence_list=None, **kw): def stepCreateTaskReportLine(self, sequence=None, sequence_list=None, **kw):
""" """
Create task report line and fill with dummy data. Create task report line and fill with dummy data.
...@@ -324,6 +373,7 @@ class TestTaskMixin: ...@@ -324,6 +373,7 @@ class TestTaskMixin:
task_report.getDescription()) task_report.getDescription())
self.assertEquals(task.getPredecessor(), task_report.getPredecessor()) self.assertEquals(task.getPredecessor(), task_report.getPredecessor())
self.assertEquals(task.getDescription(), task_report.getDescription()) self.assertEquals(task.getDescription(), task_report.getDescription())
self.assertEquals(task.getPriceCurrency(), task_report.getPriceCurrency())
self.assertEquals(len(task_report.contentValues()), 1) self.assertEquals(len(task_report.contentValues()), 1)
task_report_line = task_report.contentValues()[0] task_report_line = task_report.contentValues()[0]
self.assertEquals(task.getTaskLineResource(), task_report_line.getResource()) self.assertEquals(task.getTaskLineResource(), task_report_line.getResource())
...@@ -332,6 +382,7 @@ class TestTaskMixin: ...@@ -332,6 +382,7 @@ class TestTaskMixin:
self.assertEquals(task.getTaskLineRequirement(), self.assertEquals(task.getTaskLineRequirement(),
task_report_line.getRequirement()) task_report_line.getRequirement())
def stepCreateTaskLine(self, sequence=None, sequence_list=None, **kw): def stepCreateTaskLine(self, sequence=None, sequence_list=None, **kw):
""" """
Create task line and fill with dummy data. Create task line and fill with dummy data.
...@@ -410,6 +461,9 @@ class TestTaskMixin: ...@@ -410,6 +461,9 @@ class TestTaskMixin:
def stepCloseTaskReport(self, sequence=None, sequence_list=None, **kw): def stepCloseTaskReport(self, sequence=None, sequence_list=None, **kw):
self.modifyState('task_report', 'deliver', sequence=sequence) self.modifyState('task_report', 'deliver', sequence=sequence)
def stepRestartTaskReport(self, sequence=None, sequence_list=None, **kw):
self.modifyState('task_report', 'restart', sequence=sequence)
def stepSetTaskReport(self, sequence=None, sequence_list=None, **kw): def stepSetTaskReport(self, sequence=None, sequence_list=None, **kw):
""" """
Set task report object in sequence. Set task report object in sequence.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment