def test_add_variable_float_fail(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.Float) dia.valLineEdit.setText("oiuiu") with pytest.raises(ValueError): args = dia.get_args() new_node = mgr.add_variable(*args)
def test_add_variable_double_list(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.Double) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children() assert isinstance(new_node.get_value(), float)
def test_add_variable_double_list(self): self.modeler.tree_ui.expand_to_node("Objects") val = [9.9, 5.5, 1.2] dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.get_current_server(), default_value=val, dtype=ua.ObjectIds.Double) args = dia.get_args() new_node = self.mgr.add_variable(*args) self.assertIn(new_node, self.modeler.get_current_server().nodes.objects.get_children()) self.assertEqual(val, new_node.get_value())
def test_add_variable_bytes(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.ByteString) val = b"lkjkjl" dia.valLineEdit.setText(val.decode()) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children() assert val == new_node.get_value()
def test_add_variable_float_fail(self): self.modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.get_current_server(), default_value=b"lkjkl", dtype=ua.ObjectIds.Float) with self.assertRaises(ValueError): args = dia.get_args() new_node = self.mgr.add_variable(*args)
def test_add_variable_extobj(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.Structure) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children( )
def test_add_variable_double_list(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.Double) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children( ) assert isinstance(new_node.read_value(), float)
def test_add_variable_bytes(self): self.modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.get_current_server(), default_value=b"lkjkl", dtype=ua.ObjectIds.ByteString) args = dia.get_args() new_node = self.mgr.add_variable(*args) self.assertIn( new_node, self.modeler.get_current_server().nodes.objects.get_children())
def test_add_variable_double(self): self.modeler.tree_ui.set_current_node("Objects") dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.get_current_server(), default_value=9.99, dtype=ua.ObjectIds.Double) args = dia.get_args() new_node = self.modeler.model_mgr.add_variable(*args) self.assertIn( new_node, self.modeler.get_current_server().nodes.objects.get_children())
def test_add_variable_bytes(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.ByteString) val = b"lkjkjl" dia.valLineEdit.setText(val.decode()) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children( ) assert val == new_node.read_value()
def test_add_variable_extobj(modeler, mgr, model): modeler.tree_ui.expand_to_node("Objects") dia = NewUaVariableDialog(modeler, "Add Variable", modeler.get_current_server(), dtype=ua.ObjectIds.Structure) args = dia.get_args() new_node = mgr.add_variable(*args) assert new_node in modeler.get_current_server().nodes.objects.get_children()