Commit 5af68cda authored by Ivan Tyagov's avatar Ivan Tyagov

Test GET / UPDATE operations.

parent 98d4adc2
......@@ -52,7 +52,7 @@ class TestDataInestOPCUADocumentgestion(ERP5TypeTestCase):
default_opcua_document.setNodeDict({})
self.tic()
# test HTTP GET returns empy dict
# test HTTP GET returns empty dict
result_dict = self.portal.ERP5Site_handleOPCUARequest(http_method="GET",
default_opcua_document=default_opcua_document)
self.assertEqual(json.dumps({}), result_dict)
......@@ -68,3 +68,19 @@ class TestDataInestOPCUADocumentgestion(ERP5TypeTestCase):
# convert from JSON string to dict
result_dict = json.loads(result_json)
self.assertEqual({node_id: node_val}, result_dict)
# test getting over a client
result_json = self.portal.ERP5Site_handleOPCUARequest(http_method="GET",
default_opcua_document=default_opcua_document)
result_dict = json.loads(result_json)
self.assertEqual({node_id: node_val}, result_dict)
# test UPDATE
node_val = 100
opcua_structure = {"node": node_id,
"val":node_val}
result_json = self.portal.ERP5Site_handleOPCUARequest(http_method="POST",
default_opcua_document=default_opcua_document,
data = json.dumps(opcua_structure))
result_dict = json.loads(result_json)
self.assertEqual({node_id: node_val}, result_dict)
\ No newline at end of file
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