document.assign_document - support batching #4474

This commit is contained in:
Andrej730
2024-04-15 16:32:54 +05:00
parent 1f605484d9
commit 097f44284f
12 changed files with 91 additions and 51 deletions
+1 -1
View File
@@ -109,7 +109,7 @@ def remove_document(ifc, document_tool, document=None):
def assign_document(ifc, product=None, document=None):
ifc.run("document.assign_document", product=product, document=document)
ifc.run("document.assign_document", products=[product], document=document)
def unassign_document(ifc, product=None, document=None):
+2 -2
View File
@@ -241,7 +241,7 @@ def add_drawing(ifc, collector, drawing, target_view=None, location_hint=None):
attributes = {"Identification": "X", "Name": drawing_name, "Scope": "DRAWING"}
ifc.run("document.edit_information", information=information, attributes=attributes)
ifc.run("document.edit_reference", reference=reference, attributes={"Location": uri})
ifc.run("document.assign_document", product=element, document=reference)
ifc.run("document.assign_document", products=[element], document=reference)
drawing.import_drawings()
@@ -276,7 +276,7 @@ def duplicate_drawing(ifc, drawing_tool, drawing=None, should_duplicate_annotati
attributes = {"Identification": "X", "Name": drawing_name, "Scope": "DRAWING"}
ifc.run("document.edit_information", information=information, attributes=attributes)
ifc.run("document.edit_reference", reference=reference, attributes={"Location": uri})
ifc.run("document.assign_document", product=new_drawing, document=reference)
ifc.run("document.assign_document", products=[new_drawing], document=reference)
drawing_tool.import_drawings()
return new_drawing
+1 -1
View File
@@ -133,7 +133,7 @@ class TestRemoveDocument:
class TestAssignDocument:
def test_run(self, ifc):
ifc.run("document.assign_document", product="product", document="document").should_be_called()
ifc.run("document.assign_document", products=["product"], document="document").should_be_called()
subject.assign_document(ifc, product="product", document="document")
+2 -2
View File
@@ -365,7 +365,7 @@ class TestAddDrawing:
attributes={"Identification": "X", "Name": "name", "Scope": "DRAWING"},
).should_be_called()
ifc.run("document.edit_reference", reference="reference", attributes={"Location": "uri"}).should_be_called()
ifc.run("document.assign_document", product="element", document="reference").should_be_called()
ifc.run("document.assign_document", products=["element"], document="reference").should_be_called()
drawing.import_drawings().should_be_called()
subject.add_drawing(ifc, collector, drawing, target_view="target_view", location_hint="location_hint")
@@ -405,7 +405,7 @@ class TestDuplicateDrawing:
ifc.run(
"document.edit_reference", reference="reference", attributes={"Location": "drawing_path"}
).should_be_called()
ifc.run("document.assign_document", product="new_drawing", document="reference").should_be_called()
ifc.run("document.assign_document", products=["new_drawing"], document="reference").should_be_called()
drawing.import_drawings().should_be_called()
subject.duplicate_drawing(ifc, drawing, drawing="drawing", should_duplicate_annotations=True)