Commit 357aa49b authored by Titouan Soulard's avatar Titouan Soulard Committed by Romain Courteaud

slapos_jio_api_style: update tests after rebase

parent 784754e9
...@@ -86,14 +86,8 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin): ...@@ -86,14 +86,8 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin):
self.commit() self.commit()
# Prepare compute_node # Prepare compute_node
self.compute_node = self.portal.compute_node_module.template_compute_node\ compute_node, _ = self.addComputeNodeAndPartition(self.project)
.Base_createCloneDocument(batch_mode=1) self.compute_node = compute_node
self.compute_node.edit(
title="Compute Node %s" % self.new_id,
reference="TESTCOMP-%s" % self.new_id,
follow_up_value=self.project
)
self.compute_node.validate()
# Make compute node access # Make compute node access
self._addCertificateLogin(self.compute_node) self._addCertificateLogin(self.compute_node)
...@@ -131,6 +125,7 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin): ...@@ -131,6 +125,7 @@ class TestSlapOSJIOAPIMixin(SlapOSTestCaseMixin):
def allDocsToApi(self, data_dict): def allDocsToApi(self, data_dict):
self.portal.REQUEST.set("live_test", True) self.portal.REQUEST.set("live_test", True)
self.portal.REQUEST.set("BODY", json.dumps(data_dict)) self.portal.REQUEST.set("BODY", json.dumps(data_dict))
self.portal.REQUEST.set("REQUEST_METHOD", "POST")
return json_loads_byteified(self.web_site.api.allDocs()) return json_loads_byteified(self.web_site.api.allDocs())
def callUpdateRevision(self): def callUpdateRevision(self):
...@@ -190,7 +185,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -190,7 +185,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
"compute_node_id": self.compute_node_id, "compute_node_id": self.compute_node_id,
"portal_type": "Software Instance", "portal_type": "Software Instance",
}) })
response = self.portal.REQUEST.RESPONSE response = self.portal.REQUEST.RESPONSE
if 200 != response.getStatus(): if 200 != response.getStatus():
raise ValueError("Unexpected Result %s" % instance_list_response) raise ValueError("Unexpected Result %s" % instance_list_response)
self.assertEqual('application/json', self.assertEqual('application/json',
...@@ -200,7 +195,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin): ...@@ -200,7 +195,7 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJIOAPIMixin):
result_list = instance_list_response["result_list"] result_list = instance_list_response["result_list"]
self.assertEqual(3, len(result_list)) self.assertEqual(3, len(result_list))
# This is the expected instance list, it is sorted by api_revision # This is the expected instance list, it is sorted by api_revision
instance_list = [instance_1, instance_2, instance_3] instance_list = [instance_1, instance_2, instance_3]
instance_list.sort(key=lambda x: x.getJIOAPIRevision(self.web_site.api.getRelativeUrl())) instance_list.sort(key=lambda x: x.getJIOAPIRevision(self.web_site.api.getRelativeUrl()))
......
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