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

slapos_json_rpc_api: tests

parent 05e90706
......@@ -783,22 +783,30 @@ class TestSlapOSSlapToolInstanceAccess(TestSlapOSJsonRpcMixin):
<parameter id="p1e">v1e</parameter>
</instance>
"""
self.called_update_connection_kw = ""
def calledUdpateConnection(*args, **kw):
self.called_update_connection_kw = kw
try:
updateConnection = self.start_requested_software_instance.__class__.updateConnection
self.start_requested_software_instance.__class__.updateConnection = calledUdpateConnection
self.login(self.start_requested_software_instance.getUserId())
self.callInstancePutToApiAndCheck({
with PinnedDateTime(self, DateTime('2020/05/19')):
response = self.callJsonRpcWebService(
"slapos.put.slapos_jio_api_put_software_instance",
{
"reference": self.start_requested_software_instance.getReference(),
"portal_type": "Software Instance",
"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})
finally:
self.start_requested_software_instance.__class__.updateConnection = updateConnection
self.assertEqual(response.getStatus(), 200)
self.assertEqual(self.start_requested_software_instance.getConnectionXml(), stored_xml)
def test_InstanceAccess_15_softwareInstanceError(self):
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