Beispiel #1
0
 def test_unknown_extension_object(self):
     obj = ua.ExtensionObject()
     obj.Body = b'example of data in custom format'
     obj.TypeId = ua.NodeId.from_string('ns=3;i=42')
     data = ua.utils.Buffer(extensionobject_to_binary(obj))
     obj2 = extensionobject_from_binary(data)
     self.assertEqual(type(obj2), ua.ExtensionObject)
     self.assertEqual(obj2.TypeId, obj.TypeId)
     self.assertEqual(obj2.Body, b'example of data in custom format')
Beispiel #2
0
 def test_unknown_extension_object(self):
     obj = ua.ExtensionObject()
     obj.Body = b'example of data in custom format'
     obj.TypeId = ua.NodeId.from_string('ns=3;i=42')
     data = ua.utils.Buffer(extensionobject_to_binary(obj))
     obj2 = extensionobject_from_binary(data)
     self.assertEqual(type(obj2), ua.ExtensionObject)
     self.assertEqual(obj2.TypeId, obj.TypeId)
     self.assertEqual(obj2.Body, b'example of data in custom format')
Beispiel #3
0
 def test_extension_object(self):
     obj = ua.UserNameIdentityToken()
     obj.UserName = "******"
     obj.Password = b"pass"
     obj2 = extensionobject_from_binary(ua.utils.Buffer(extensionobject_to_binary(obj)))
     self.assertEqual(type(obj), type(obj2))
     self.assertEqual(obj.UserName, obj2.UserName)
     self.assertEqual(obj.Password, obj2.Password)
     v1 = ua.Variant(obj)
     v2 = variant_from_binary(ua.utils.Buffer(variant_to_binary(v1)))
     self.assertEqual(type(v1), type(v2))
     self.assertEqual(v1.VariantType, v2.VariantType)
Beispiel #4
0
 def test_extension_object(self):
     obj = ua.UserNameIdentityToken()
     obj.UserName = "******"
     obj.Password = b"pass"
     obj2 = extensionobject_from_binary(ua.utils.Buffer(extensionobject_to_binary(obj)))
     self.assertEqual(type(obj), type(obj2))
     self.assertEqual(obj.UserName, obj2.UserName)
     self.assertEqual(obj.Password, obj2.Password)
     v1 = ua.Variant(obj)
     v2 = variant_from_binary(ua.utils.Buffer(variant_to_binary(v1)))
     self.assertEqual(type(v1), type(v2))
     self.assertEqual(v1.VariantType, v2.VariantType)