Commit 526864c7 authored by Romain Courteaud's avatar Romain Courteaud

slapos_crm: fixup InstanceTree_deleteFromRegularisationRequest tests

parent 195eb4cd
......@@ -15,7 +15,8 @@ if (slap_state in ['start_requested', 'stop_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
......@@ -496,29 +496,30 @@ class TestSlapOSInstanceTree_stopFromRegularisationRequest(
class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
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_deleteFromRegularisationRequest_REQUEST_disallowed(self):
def test_deleteFromRegularisationRequest_REQUESTdisallowed(self):
self.assertRaises(
Unauthorized,
self.portal.InstanceTree_deleteFromRegularisationRequest,
'',
REQUEST={})
def test_deleteFromRegularisationRequest_started_subscription(self):
def test_deleteFromRegularisationRequest_startedSubscription(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(),
)
......@@ -544,10 +545,10 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
self.assertEqual(instance_tree.isRootSlave(), shared)
self.assertEqual(instance_tree.getSlapState(), "destroy_requested")
def test_deleteFromRegularisationRequest_stopped_subscription(self):
def test_deleteFromRegularisationRequest_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(),
)
......@@ -575,10 +576,10 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
self.assertEqual(instance_tree.isRootSlave(), shared)
self.assertEqual(instance_tree.getSlapState(), "destroy_requested")
def test_deleteFromRegularisationRequest_destroyed_subscription(self):
def test_deleteFromRegularisationRequest_destroyedSubscription(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(),
)
......@@ -590,8 +591,9 @@ class TestSlapOSInstanceTree_deleteFromRegularisationRequest(
self.assertEqual(result, False)
def test_deleteFromRegularisationRequest_non_matching_person(self):
instance_tree = self.createInstanceTree()
def test_deleteFromRegularisationRequest_nonMatchingPerson(self):
project = self.addProject()
instance_tree = self.createInstanceTree(project)
self.assertRaises(
AssertionError,
instance_tree.InstanceTree_deleteFromRegularisationRequest,
......
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