|
|
|
@ -400,6 +400,68 @@ class WiringTest(unittest.TestCase):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
os.environ["QET_2D_TO_3D_JSON"] = old_json
|
|
|
|
os.environ["QET_2D_TO_3D_JSON"] = old_json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_writeback_skips_local_terminal_bindings(self):
|
|
|
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
|
|
|
terminal_objects, _wiring_objects, _manual_wiring, write_back = _reload_modules()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
|
|
|
root = terminal_objects.ensure_root_group(doc, "project-1")
|
|
|
|
|
|
|
|
device = doc.addObject("App::DocumentObjectGroup", "QETDevice_device_a")
|
|
|
|
|
|
|
|
root.addObject(device)
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(
|
|
|
|
|
|
|
|
device,
|
|
|
|
|
|
|
|
"QetElementUuid",
|
|
|
|
|
|
|
|
"QET Exchange",
|
|
|
|
|
|
|
|
"Element UUID",
|
|
|
|
|
|
|
|
"device-a",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
terminal_objects.ensure_string_property(
|
|
|
|
|
|
|
|
device,
|
|
|
|
|
|
|
|
"QetInstanceId",
|
|
|
|
|
|
|
|
"QET Exchange",
|
|
|
|
|
|
|
|
"Instance ID",
|
|
|
|
|
|
|
|
"instance-a",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
terminal_group = terminal_objects.ensure_terminal_group(
|
|
|
|
|
|
|
|
doc,
|
|
|
|
|
|
|
|
device,
|
|
|
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
|
|
|
instance_id="instance-a",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qet_terminal = terminal_objects.create_lcs_object(doc, "QETTerminal_A")
|
|
|
|
|
|
|
|
terminal_group.addObject(qet_terminal)
|
|
|
|
|
|
|
|
terminal_objects.set_terminal_semantics(
|
|
|
|
|
|
|
|
qet_terminal,
|
|
|
|
|
|
|
|
"project-1",
|
|
|
|
|
|
|
|
"device-a",
|
|
|
|
|
|
|
|
"terminal-a",
|
|
|
|
|
|
|
|
"instance-a",
|
|
|
|
|
|
|
|
label="A",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
local_terminal = terminal_objects.create_lcs_object(doc, "QETTerminal_Local")
|
|
|
|
|
|
|
|
terminal_group.addObject(local_terminal)
|
|
|
|
|
|
|
|
terminal_objects.set_terminal_semantics(
|
|
|
|
|
|
|
|
local_terminal,
|
|
|
|
|
|
|
|
"project-1",
|
|
|
|
|
|
|
|
"device-a",
|
|
|
|
|
|
|
|
"local:instance-a:P1",
|
|
|
|
|
|
|
|
"instance-a",
|
|
|
|
|
|
|
|
label="P1",
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with tempfile.TemporaryDirectory() as tmp_dir:
|
|
|
|
|
|
|
|
report = write_back.write_back_document(
|
|
|
|
|
|
|
|
doc,
|
|
|
|
|
|
|
|
scene_path=str(Path(tmp_dir) / "scene.FCStd"),
|
|
|
|
|
|
|
|
payload={"project_uuid": "project-1"},
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
|
|
|
[{"terminal_uuid": "terminal-a", "instance_id": "instance-a"}],
|
|
|
|
|
|
|
|
report["terminals"],
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
if __name__ == "__main__":
|
|
|
|
unittest.main()
|
|
|
|
unittest.main()
|
|
|
|
|