@@ 49-58 (lines=10) @@ | ||
46 | new_node = objects.add_variable(*args) |
|
47 | self.assertIn(new_node, objects.get_children()) |
|
48 | ||
49 | def test_add_variable_double_list(self): |
|
50 | objects = self.modeler.server.nodes.objects |
|
51 | self.modeler.tree_ui.set_current_node("Objects") |
|
52 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
53 | val = [9.9, 5.5, 1.2] |
|
54 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value=val, dtype=ua.ObjectIds.Double) |
|
55 | args = dia.get_args() |
|
56 | new_node = objects.add_variable(*args) |
|
57 | self.assertIn(new_node, objects.get_children()) |
|
58 | self.assertEqual(val, new_node.get_value()) |
|
59 | ||
60 | def test_add_variable_string(self): |
|
61 | objects = self.modeler.server.nodes.objects |
|
@@ 87-94 (lines=8) @@ | ||
84 | new_node = objects.add_variable(*args) |
|
85 | self.assertIn(new_node, objects.get_children()) |
|
86 | ||
87 | def test_add_variable_float_fail(self): |
|
88 | objects = self.modeler.server.nodes.objects |
|
89 | self.modeler.tree_ui.set_current_node("Objects") |
|
90 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
91 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value=b"lkjkl", dtype=ua.ObjectIds.Float) |
|
92 | with self.assertRaises(ValueError): |
|
93 | args = dia.get_args() |
|
94 | new_node = objects.add_variable(*args) |
|
95 | ||
96 | ||
97 | ||
@@ 78-85 (lines=8) @@ | ||
75 | new_node = objects.add_variable(*args) |
|
76 | self.assertIn(new_node, objects.get_children()) |
|
77 | ||
78 | def test_add_variable_bytes(self): |
|
79 | objects = self.modeler.server.nodes.objects |
|
80 | self.modeler.tree_ui.set_current_node("Objects") |
|
81 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
82 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value=b"lkjkl", dtype=ua.ObjectIds.ByteString) |
|
83 | args = dia.get_args() |
|
84 | new_node = objects.add_variable(*args) |
|
85 | self.assertIn(new_node, objects.get_children()) |
|
86 | ||
87 | def test_add_variable_float_fail(self): |
|
88 | objects = self.modeler.server.nodes.objects |
|
@@ 69-76 (lines=8) @@ | ||
66 | new_node = objects.add_variable(*args) |
|
67 | self.assertIn(new_node, objects.get_children()) |
|
68 | ||
69 | def test_add_variable_extobj(self): |
|
70 | objects = self.modeler.server.nodes.objects |
|
71 | self.modeler.tree_ui.set_current_node("Objects") |
|
72 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
73 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value="lkjkl", dtype=ua.ObjectIds.Structure) |
|
74 | args = dia.get_args() |
|
75 | new_node = objects.add_variable(*args) |
|
76 | self.assertIn(new_node, objects.get_children()) |
|
77 | ||
78 | def test_add_variable_bytes(self): |
|
79 | objects = self.modeler.server.nodes.objects |
|
@@ 60-67 (lines=8) @@ | ||
57 | self.assertIn(new_node, objects.get_children()) |
|
58 | self.assertEqual(val, new_node.get_value()) |
|
59 | ||
60 | def test_add_variable_string(self): |
|
61 | objects = self.modeler.server.nodes.objects |
|
62 | self.modeler.tree_ui.set_current_node("Objects") |
|
63 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
64 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value="lkjkl", dtype=ua.ObjectIds.String) |
|
65 | args = dia.get_args() |
|
66 | new_node = objects.add_variable(*args) |
|
67 | self.assertIn(new_node, objects.get_children()) |
|
68 | ||
69 | def test_add_variable_extobj(self): |
|
70 | objects = self.modeler.server.nodes.objects |
|
@@ 40-47 (lines=8) @@ | ||
37 | new_node = objects.add_folder(*args) |
|
38 | self.assertIn(new_node, objects.get_children()) |
|
39 | ||
40 | def test_add_variable_double(self): |
|
41 | objects = self.modeler.server.nodes.objects |
|
42 | self.modeler.tree_ui.set_current_node("Objects") |
|
43 | self.assertEqual(objects, self.modeler.tree_ui.get_current_node()) |
|
44 | dia = NewUaVariableDialog(self.modeler, "Add Variable", self.modeler.server, default_value=9.99, dtype=ua.ObjectIds.Double) |
|
45 | args = dia.get_args() |
|
46 | new_node = objects.add_variable(*args) |
|
47 | self.assertIn(new_node, objects.get_children()) |
|
48 | ||
49 | def test_add_variable_double_list(self): |
|
50 | objects = self.modeler.server.nodes.objects |