(self)
| 730 | self.assertTrue(endpoints[0].EndpointUrl.startswith("opc.tcp://")) |
| 731 | |
| 732 | def test_copy_node(self): |
| 733 | dev_t = self.opc.nodes.base_data_type.add_object_type(0, "MyDevice") |
| 734 | v_t = dev_t.add_variable(0, "sensor", 1.0) |
| 735 | p_t = dev_t.add_property(0, "sensor_id", "0340") |
| 736 | ctrl_t = dev_t.add_object(0, "controller") |
| 737 | prop_t = ctrl_t.add_property(0, "state", "Running") |
| 738 | # Create device sutype |
| 739 | devd_t = dev_t.add_object_type(0, "MyDeviceDervived") |
| 740 | v_t = devd_t.add_variable(0, "childparam", 1.0) |
| 741 | p_t = devd_t.add_property(0, "sensorx_id", "0340") |
| 742 | |
| 743 | |
| 744 | nodes = copy_node(self.opc.nodes.objects, dev_t) |
| 745 | mydevice = nodes[0] |
| 746 | |
| 747 | self.assertEqual(mydevice.get_node_class(), ua.NodeClass.ObjectType) |
| 748 | self.assertEqual(len(mydevice.get_children()), 4) |
| 749 | obj = mydevice.get_child(["0:controller"]) |
| 750 | prop = mydevice.get_child(["0:controller", "0:state"]) |
| 751 | self.assertEqual(prop.get_type_definition().Identifier, ua.ObjectIds.PropertyType) |
| 752 | self.assertEqual(prop.get_value(), "Running") |
| 753 | self.assertNotEqual(prop.nodeid, prop_t.nodeid) |
| 754 | |
| 755 | def test_instantiate_1(self): |
| 756 | # Create device type |
nothing calls this directly
no test coverage detected