Commit 9f40b63a authored by Romain Courteaud's avatar Romain Courteaud

slapos_json_rpc_api: tests

parent 05e90706
...@@ -783,22 +783,30 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin): ...@@ -783,22 +783,30 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
<parameter id="p1e">v1e</parameter> <parameter id="p1e">v1e</parameter>
</instance> </instance>
""" """
self.called_update_connection_kw = ""
def calledUdpateConnection(*args, **kw):
self.called_update_connection_kw = kw
try: with PinnedDateTime(self, DateTime('2020/05/19')):
updateConnection = self.start_requested_software_instance.__class__.updateConnection response = self.callJsonRpcWebService(
self.start_requested_software_instance.__class__.updateConnection = calledUdpateConnection "slapos.put.slapos_jio_api_put_software_instance",
self.login(self.start_requested_software_instance.getUserId()) {
self.callInstancePutToApiAndCheck({
"reference": self.start_requested_software_instance.getReference(), "reference": self.start_requested_software_instance.getReference(),
"portal_type": "Software Instance", "portal_type": "Software Instance",
"connection_parameters": connection_parameters_dict, "connection_parameters": connection_parameters_dict,
},
self.start_requested_software_instance.getUserId()
)
self.assertEqual('application/json', response.headers.get('content-type'))
self.assertEqual(
byteify(json.loads(response.getBody())),
{
'reference': self.start_requested_software_instance.getReference(),
'date': '2020-05-19T00:00:00+00:00',
'portal_type': 'Software Instance',
'success': 'Done'
}) })
self.assertEqual(self.called_update_connection_kw, {"connection_xml": stored_xml}) self.assertEqual(response.getStatus(), 200)
finally:
self.start_requested_software_instance.__class__.updateConnection = updateConnection self.assertEqual(self.start_requested_software_instance.getConnectionXml(), stored_xml)
def test_InstanceAccess_15_softwareInstanceError(self): def test_InstanceAccess_15_softwareInstanceError(self):
self._makeComplexComputeNode(self.project) self._makeComplexComputeNode(self.project)
......
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