(self)
| 24 | assertEqual = dir |
| 25 | |
| 26 | def test_xml_import(self): |
| 27 | self.opc.import_xml("tests/custom_nodes.xml") |
| 28 | o = self.opc.get_objects_node() |
| 29 | v = o.get_child(["1:MyXMLFolder", "1:MyXMLObject", "1:MyXMLVariable"]) |
| 30 | val = v.get_value() |
| 31 | self.assertEqual(val, "StringValue") |
| 32 | |
| 33 | node_path = ["Types", "DataTypes", "BaseDataType", "Enumeration", |
| 34 | "1:MyEnum", "0:EnumStrings"] |
| 35 | o = self.opc.get_root_node().get_child(node_path) |
| 36 | self.assertEqual(len(o.get_value()), 3) |
| 37 | |
| 38 | # Check if method is imported |
| 39 | node_path = ["Types", "ObjectTypes", "BaseObjectType", |
| 40 | "1:MyObjectType", "1:MyMethod"] |
| 41 | o = self.opc.get_root_node().get_child(node_path) |
| 42 | self.assertEqual(len(o.get_referenced_nodes()), 4) |
| 43 | |
| 44 | # Check if InputArgs are imported and can be read |
| 45 | node_path = ["Types", "ObjectTypes", "BaseObjectType", |
| 46 | "1:MyObjectType", "1:MyMethod", "InputArguments"] |
| 47 | o = self.opc.get_root_node().get_child(node_path) |
| 48 | input_arg = o.get_data_value().Value.Value[0] |
| 49 | self.assertEqual(input_arg.Name, 'Context') |
| 50 | |
| 51 | def test_xml_import_additional_ns(self): |
| 52 | self.srv.register_namespace('http://placeholder.toincrease.nsindex') # if not already shift the new namespaces |
nothing calls this directly
no test coverage detected