Commit 3355eb8e authored by oroulet's avatar oroulet

add first simple tests for data_type_definitions

parent f08c39b8
......@@ -21,6 +21,7 @@ from ..common.manage_nodes import delete_nodes
from ..common.event_objects import BaseEvent
from ..common.shortcuts import Shortcuts
from ..common.structures import load_type_definitions, load_enums
from ..common.structures104 import load_data_type_definitions
from ..common.ua_utils import get_nodes_of_namespace
from ..crypto import security_policies, uacrypto
......@@ -618,12 +619,22 @@ class Server:
Server side this can be used to create python objects from custom structures
imported through xml into server
"""
_logger.warning("Deprecated since spec 1.04, call load_data_type_definitions")
return await load_type_definitions(self, nodes)
async def load_data_type_definitions(self, node=None):
"""
Load custom types (custom structures/extension objects) definition from server
Generate Python classes for custom structures/extension objects defined in server
These classes will be available in ua module
"""
return await load_data_type_definitions(self, node)
async def load_enums(self) -> Coroutine:
"""
load UA structures and generate python Enums in ua module for custom enums in server
"""
_logger.warning("Deprecated since spec 1.04, call load_data_type_definitions")
return await load_enums(self)
async def write_attribute_value(self, nodeid, datavalue, attr=ua.AttributeIds.Value):
......
......@@ -982,3 +982,8 @@ async def test_guid_node_id():
node = Node(None, "ns=4;g=35d5f86f-2777-4550-9d48-b098f5ee285c")
binary_node_id = ua.ua_binary.nodeid_to_binary(node.nodeid)
assert type(binary_node_id) is bytes
async def test_import_xml_data_type_definition(opc):
nodes = await opc.opc.import_xml("tests/substructs.xml")
await opc.opc.load_data_type_definitions()
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