Commit 3324f328 authored by Romain Courteaud's avatar Romain Courteaud

slapos_json_rpc_api: test request

parent 3c953e18
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
"type": "object",\n "type": "object",\n
"additionalProperties": false,\n "additionalProperties": false,\n
"properties": {\n "properties": {\n
\n
"message": {\n "message": {\n
"title": "Message",\n "title": "Message",\n
"type": "string"\n "type": "string"\n
...@@ -48,13 +49,131 @@ ...@@ -48,13 +49,131 @@
"status": {\n "status": {\n
"title": "Status",\n "title": "Status",\n
"type": "integer"\n "type": "integer"\n
},\n
\n
"compute_node_id": {\n
"title": "Compute Node Id",\n
"type": "string",\n
"description": "Id Of the Requesting Compute Node, used by Slap Client when an instance is requesting an instance"\n
},\n
"portal_type": {\n
"title": "Portal Type",\n
"const": "Software Instance",\n
"type": "string"\n
},\n
"reference": {\n
"title": "Software Instance Reference",\n
"description": "Unique identifier of the Software Instance",\n
"type": "string"\n
},\n
"root_instance_title": {\n
"title": "Title of the Roor Instance",\n
"type": "string"\n
},\n
"title": {\n
"title": "Unique Title of the Instance",\n
"type": "string"\n
},\n
"state": {\n
"title": "Requested State",\n
"type": "string",\n
"enum": ["started", "stopped", "destroyed"],\n
"description": "State of the requested instance. It is functionnal when started. In stopped state, all services are stopped. If destroyed, it will remove the instance."\n
},\n
"compute_partition_id": {\n
"title": "Compute Partition Id",\n
"type": "string",\n
"description": "Id Of the Requesting Compute Partition, used by Slap Client when an instance is requesting an instance"\n
},\n
"software_release_uri": {\n
"title": "Software Release URI",\n
"type": "string",\n
"description": "URL of the software release used by the software instance"\n
},\n
"software_type": {\n
"title": "Software Type",\n
"type": "string"\n
},\n
"shared": {\n
"title": "Shared",\n
"type": "boolean",\n
"description": "Is it a shared instance"\n
},\n
"processing_timestamp": {\n
"title": "Processing Timestamp",\n
"type": "integer"\n
},\n
"access_status_message": {\n
"title": "Access Status Message",\n
"type": "string"\n
},\n
"parameters": {\n
"title": "Parameters",\n
"type": "object"\n
},\n
"sla_parameters": {\n
"title": "SLA Parameters",\n
"type": "object"\n
},\n
"connection_parameters": {\n
"title": "Connection Parameters",\n
"type": "object"\n
},\n
"ip_list": {\n
"title": "IP List",\n
"type": "array",\n
"description": "List of IPs usable by the Software Instance on the partition.",\n
"items": {\n
"type": "array",\n
"title": "Internet Protocol Address",\n
"description": "All elements to describe the interface",\n
"items": {\n
"type": "string"\n
}\n
}\n }\n
},\n },\n
"full_ip_list": {\n
"title": "Full IP List",\n
"type": "array",\n
"description": "List of IPs usable by the Software Instance on the partition.",\n
"items": {\n
"type": "array",\n
"title": "Internet Protocol Address",\n
"description": "All elements to describe the interface",\n
"items": {\n
"type": "string"\n
}\n
}\n
}\n
},\n
\n
"oneOf": [{\n
"required": [\n
"compute_node_id",\n
"portal_type",\n
"reference",\n
"root_instance_title",\n
"title",\n
"state",\n
"compute_partition_id",\n
"software_release_uri",\n
"software_type",\n
"shared",\n
"processing_timestamp",\n
"access_status_message",\n
"parameters",\n
"sla_parameters",\n
"connection_parameters",\n
"ip_list",\n
"full_ip_list"\n
]\n
},{\n
"required": [\n "required": [\n
"message",\n "message",\n
"name",\n "name",\n
"status"\n "status"\n
]\n ]\n
}]\n
}\n }\n
</string> </value> </string> </value>
</item> </item>
......
...@@ -1515,7 +1515,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin): ...@@ -1515,7 +1515,6 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin):
) )
self._makeComplexComputeNode(self.project, person=self.person) self._makeComplexComputeNode(self.project, person=self.person)
instance = self.start_requested_software_instance instance = self.start_requested_software_instance
instance.updateLocalRolesOnSecurityGroups()
self.callUpdateRevision() self.callUpdateRevision()
self.tic() self.tic()
self.login(self.person_user_id) self.login(self.person_user_id)
...@@ -1526,18 +1525,14 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin): ...@@ -1526,18 +1525,14 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin):
"software_type": instance.getSourceReference(), "software_type": instance.getSourceReference(),
"title": instance.getTitle(), "title": instance.getTitle(),
"project_reference": self.project.getReference() "project_reference": self.project.getReference()
}) },
self.person_user_id)
instance_dict = json.loads(response.getBody())
if 201 != response.getStatus():
raise ValueError("Unexpected Result %s" % instance_dict)
self.assertEqual('application/json',
response.headers.get('content-type'))
# Check Data is correct # Check Data is correct
self.login()
partition = instance.getAggregateValue(portal_type="Compute Partition") partition = instance.getAggregateValue(portal_type="Compute Partition")
self.assertEqual('application/json', response.headers.get('content-type'))
self.assertEqual({ self.assertEqual({
"$schema": instance.getJSONSchemaUrl(), #"$schema": instance.getJSONSchemaUrl(),
"title": instance.getTitle(), "title": instance.getTitle(),
"reference": instance.getReference(), "reference": instance.getReference(),
"software_release_uri": instance.getUrlString(), "software_release_uri": instance.getUrlString(),
...@@ -1560,9 +1555,10 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin): ...@@ -1560,9 +1555,10 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin):
"compute_partition_id": partition.getReference(), "compute_partition_id": partition.getReference(),
"processing_timestamp": instance.getSlapTimestamp(), "processing_timestamp": instance.getSlapTimestamp(),
"access_status_message": instance.getTextAccessStatus(), "access_status_message": instance.getTextAccessStatus(),
"api_revision": instance.getJIOAPIRevision(self.web_site.api.getRelativeUrl()), #"api_revision": instance.getJIOAPIRevision(self.web_site.api.getRelativeUrl()),
"portal_type": instance.getPortalType(), "portal_type": instance.getPortalType(),
}, instance_dict) }, byteify(json.loads(response.getBody())))
self.assertEqual(response.getStatus(), 200)
def test_PersonAccess_37_ComputeNodeSupply(self): def test_PersonAccess_37_ComputeNodeSupply(self):
software_url = 'live💩é /?%%20_test_url_%s' % self.generateNewId() software_url = 'live💩é /?%%20_test_url_%s' % self.generateNewId()
......
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