Commit 534272e2 authored by Romain Courteaud's avatar Romain Courteaud

slapos_json_rpc_api: tests

parent 515bb9c3
import json
software_instance = context.getParentValue()
return json.dumps({
"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema",
software_instance = context.jIOWebSection_getObjectFromData(data_dict)
# software_instance = context.getParentValue()
return {
#"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema",
"reference": software_instance.getReference(),
"key": software_instance.getSslKey(),
"certificate": software_instance.getSslCertificate(),
"portal_type": "Software Instance Certificate Record",
}, indent=2)
}
......@@ -171,11 +171,10 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
instance_2 = self.compute_node.partition2.getAggregateRelatedValue(portal_type='Software Instance')
instance_3 = self.compute_node.partition3.getAggregateRelatedValue(portal_type='Software Instance')
self.login(self.compute_node_user_id)
response = self.callJsonRpcWebService('slapos.allDocs.slapos_jio_api_search_instance', {
"compute_node_id": self.compute_node_id,
"portal_type": "Software Instance",
})
}, self.compute_node_user_id)
instance_list_response = json.loads(response.getBody())
if 200 != response.getStatus():
......@@ -221,7 +220,6 @@ class TestSlapOSSlapToolComputeNodeAccess(TestSlapOSJsonRpcMixin):
self.assertEqual('application/json',
response.headers.get('content-type'))
# Check Data is correct
self.login()
partition = instance.getAggregateValue(portal_type="Compute Partition")
self.assertEqual({
"$schema": instance.getJSONSchemaUrl(),
......@@ -571,25 +569,19 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
def test_InstanceAccess_10_getComputerPartitionCertificate(self):
self._makeComplexComputeNode(self.project)
self.login(self.start_requested_software_instance.getUserId())
response = self.callJsonRpcWebService("slapos.get.slapos_jio_api_get_software_instance_certificate", {
"portal_type": "Software Instance Certificate Record",
"reference": self.start_requested_software_instance.getReference(),
})
certificate_dict = json.loads(response.getBody())
if 200 != response.getStatus():
raise ValueError("Unexpected Result %s" % certificate_dict)
self.assertEqual('application/json',
response.headers.get('content-type'))
self.assertTrue(
certificate_dict.pop("$schema").endswith("SoftwareInstanceCertificateRecord_getFromJSON/getOutputJSONSchema")
)
self.assertEqual(certificate_dict, {
}, self.start_requested_software_instance.getUserId())
self.assertEqual('application/json', response.headers.get('content-type'))
self.assertEqual({
"key" :self.start_requested_software_instance.getSslKey(),
"certificate": self.start_requested_software_instance.getSslCertificate(),
"portal_type": "Software Instance Certificate Record",
"reference": self.start_requested_software_instance.getReference(),
})
}, byteify(json.loads(response.getBody())))
self.assertEqual(response.getStatus(), 200)
def test_InstanceAccess_11_getFullComputerInformationWithSharedInstance(self, with_slave=True):
self._makeComplexComputeNode(self.project, with_slave=with_slave)
......
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