Commit c984a567 authored by Romain Courteaud's avatar Romain Courteaud

slapos_json_rpc_api: drop not expected property in the output

parent f89fc714
...@@ -88,7 +88,7 @@ for key, value in existing_partition_dict.items(): ...@@ -88,7 +88,7 @@ for key, value in existing_partition_dict.items():
value.invalidate(comment="Desactivated by slapformat") value.invalidate(comment="Desactivated by slapformat")
return { return {
"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema", #"$schema": json_form.absolute_url().strip() + "/getOutputJSONSchema",
"compute_node_id": compute_node.getReference(), "compute_node_id": compute_node.getReference(),
"date": DateTime().ISO8601(), "date": DateTime().ISO8601(),
"portal_type": "Compute Node", "portal_type": "Compute Node",
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# #
############################################################################## ##############################################################################
from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, TemporaryAlarmScript from erp5.component.test.SlapOSTestCaseMixin import SlapOSTestCaseMixin, TemporaryAlarmScript, PinnedDateTime
from DateTime import DateTime from DateTime import DateTime
...@@ -1253,10 +1253,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin): ...@@ -1253,10 +1253,8 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin):
self.person_user_id = self.person.getUserId() self.person_user_id = self.person.getUserId()
def test_30_computerBang(self): def test_30_computerBang(self):
start_date = DateTime()
# XXX XXX XXX TODO pin datetime to check the result
error_log = 'Please force slapos node rerun' error_log = 'Please force slapos node rerun'
with PinnedDateTime(self, DateTime('2020/05/19')):
response = self.callJsonRpcWebService( response = self.callJsonRpcWebService(
"slapos.put.slapos_jio_api_put_compute_node", "slapos.put.slapos_jio_api_put_compute_node",
{ {
...@@ -1266,25 +1264,18 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin): ...@@ -1266,25 +1264,18 @@ class TestSlapOSSlapToolPersonAccess(TestSlapOSJsonRpcMixin):
}, },
self.person_user_id self.person_user_id
) )
response_dict = json.loads(response.getBody())
self.assertEqual('application/json', response.headers.get('content-type')) self.assertEqual('application/json', response.headers.get('content-type'))
"""
self.assertEqual( self.assertEqual(
response.getBody(), response.getBody(),
json.dumps( json.dumps(
{ {
'type': 'success-type', 'compute_node_id': self.compute_node.getReference(),
'title': "query completed", 'date': '2020-05-19T00:00:00+00:00',
'status': 200 'portal_type': 'Compute Node',
}).encode())""" 'success': 'Done'
}).encode())
self.assertEqual(response.getStatus(), 200) self.assertEqual(response.getStatus(), 200)
self.assertEqual(response_dict["compute_node_id"], self.compute_node.getReference().decode('UTF-8'))
self.assertEqual(response_dict["success"], "Done")
self.assertEqual(response_dict["portal_type"], "Compute Node")
self.assertTrue(response_dict["$schema"].endswith("ComputeNode_updateFromJSON/getOutputJSONSchema"))
self.assertTrue(DateTime(response_dict["date"]) >= DateTime(start_date.ISO8601()), response_dict["date"])
portal_workflow = self.portal.portal_workflow portal_workflow = self.portal.portal_workflow
comment = portal_workflow.getInfoFor(ob=self.compute_node, comment = portal_workflow.getInfoFor(ob=self.compute_node,
name='comment', name='comment',
......
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