Commit 4e7c60e2 authored by oroulet's avatar oroulet

add TypeCheck server side

parent 9acce704
......@@ -706,6 +706,13 @@ class AddressSpace:
if attval is None:
return ua.StatusCode(ua.StatusCodes.BadAttributeIdInvalid)
if value.Value.VariantType != attval.value.Value.VariantType:
if value.Value.VariantType == ua.VariantType.Null or attval.value.Value.VariantType == ua.VariantType.Null:
pass
else:
_logger.critical("Write refused: Variant: %s with type %s does not have expected type: %s", value.Value, value.Value.VariantType, attval.value.Value.VariantType)
return ua.StatusCode(ua.StatusCodes.BadTypeMismatch)
old = attval.value
attval.value = value
cbs = []
......
......@@ -538,7 +538,7 @@ async def test_add_exception(opc):
async def test_negative_value(opc):
o = opc.opc.nodes.objects
v = await o.add_variable(3, 'VariableNegativeValue', 4)
v = await o.add_variable(3, 'VariableNegativeValue', 4.0)
await v.write_value(-4.54)
assert -4.54 == await v.read_value()
await opc.opc.delete_nodes([v])
......
......@@ -91,7 +91,7 @@ async def test_permissions_admin(srv_crypto_one_cert):
objects = clt.nodes.objects
child = await objects.get_child(['0:MyObject', '0:MyVariable'])
await child.read_value()
await child.set_value(42)
await child.set_value(42.0)
async def test_permissions_user(srv_crypto_one_cert):
......
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