Commit 5b71d0ff authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_cloud: Add tests for accountant related constraint

parent 933706e5
...@@ -511,6 +511,35 @@ class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin): ...@@ -511,6 +511,35 @@ class TestSlapOSAssignmentConstraint(TestSlapOSConstraintMixin):
self.assertNotIn(consistency_message, self.getMessageList(assignment)) self.assertNotIn(consistency_message, self.getMessageList(assignment))
def test_group_for_accountant_manager(self):
person = self.portal.person_module.newContent(portal_type='Person')
person.validate()
assignment = person.newContent(
portal_type='Assignment', function="accounting/manager")
consistency_message = 'One group must be set when function is accountant '\
'manager or agent'
self.assertIn(consistency_message, self.getMessageList(assignment))
assignment.edit(group='company')
self.assertNotIn(consistency_message, self.getMessageList(assignment))
def test_group_for_accountant_agent(self):
person = self.portal.person_module.newContent(portal_type='Person')
person.validate()
assignment = person.newContent(
portal_type='Assignment', function="accounting/agent")
consistency_message = 'One group must be set when function is accountant '\
'manager or agent'
self.assertIn(consistency_message, self.getMessageList(assignment))
assignment.edit(group='company')
self.assertNotIn(consistency_message, self.getMessageList(assignment))
class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin): class TestSlapOSEmailConstraint(TestSlapOSConstraintMixin):
def test_url_string_not_empty(self): def test_url_string_not_empty(self):
email = self.portal.person_module.newContent(portal_type='Person' email = self.portal.person_module.newContent(portal_type='Person'
......
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