Commit 195eb4cd authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: fixup InstanceTree_stopFromRegularisationRequest tests

parent 695a5d7c
......@@ -15,7 +15,8 @@ if (slap_state == 'start_requested'):
software_type=instance_tree.getSourceReference(),
instance_xml=instance_tree.getTextContent(),
sla_xml=instance_tree.getSlaXml(),
shared=instance_tree.isRootSlave()
shared=instance_tree.isRootSlave(),
project_reference=instance_tree.getFollowUpReference()
)
return True
return False
......@@ -420,29 +420,30 @@ class TestSlapOSRegularisationRequest_checkToTriggerNextEscalationStep(
class TestSlapOSInstanceTree_stopFromRegularisationRequest(
SlapOSTestCaseMixinWithAbort):
def createInstanceTree(self):
def createInstanceTree(self, project):
new_id = self.generateNewId()
instance_tree = self.portal.instance_tree_module\
.template_instance_tree.Base_createCloneDocument(batch_mode=1)
instance_tree.edit(
reference="TESTHS-%s" % new_id,
follow_up_value=project
)
instance_tree.validate()
self.portal.portal_workflow._jumpToStateFor(
instance_tree, 'start_requested')
return instance_tree
def test_stopFromRegularisationRequest_REQUEST_disallowed(self):
def test_stopFromRegularisationRequest_REQUESTdisallowed(self):
self.assertRaises(
Unauthorized,
self.portal.InstanceTree_stopFromRegularisationRequest,
'',
REQUEST={})
def test_stopFromRegularisationRequest_matching_subscription(self):
def test_stopFromRegularisationRequest_matchingSubscription(self):
project = self.addProject()
person = self.makePerson(project, index=0, user=0)
instance_tree = self.createInstanceTree()
instance_tree = self.createInstanceTree(project)
instance_tree.edit(
destination_section=person.getRelativeUrl(),
)
......@@ -468,10 +469,10 @@ class TestSlapOSInstanceTree_stopFromRegularisationRequest(
self.assertEqual(instance_tree.isRootSlave(), shared)
self.assertEqual(instance_tree.getSlapState(), "stop_requested")
def test_stopFromRegularisationRequest_stopped_subscription(self):
def test_stopFromRegularisationRequest_stoppedSubscription(self):
project = self.addProject()
person = self.makePerson(project, index=0, user=0)
instance_tree = self.createInstanceTree()
instance_tree = self.createInstanceTree(project)
instance_tree.edit(
destination_section=person.getRelativeUrl(),
)
......@@ -483,13 +484,15 @@ class TestSlapOSInstanceTree_stopFromRegularisationRequest(
self.assertEqual(result, False)
def test_stopFromRegularisationRequest_non_matching_person(self):
instance_tree = self.createInstanceTree()
def test_stopFromRegularisationRequest_nonMatchingPerson(self):
project = self.addProject()
instance_tree = self.createInstanceTree(project)
self.assertRaises(
AssertionError,
instance_tree.InstanceTree_stopFromRegularisationRequest,
'foobar')
class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
SlapOSTestCaseMixinWithAbort):
......
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