mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-13 19:07:57 +00:00
Adding a document now auto adds a reference for convenience.
This commit is contained in:
@@ -61,7 +61,8 @@ def disable_editing_document(document):
|
||||
def add_information(ifc, document):
|
||||
document.clear_document_tree()
|
||||
parent = document.get_active_breadcrumb()
|
||||
ifc.run("document.add_information", parent=parent)
|
||||
information = ifc.run("document.add_information", parent=parent)
|
||||
ifc.run("document.add_reference", information=information)
|
||||
if parent:
|
||||
document.import_subdocuments(parent)
|
||||
document.import_references(parent)
|
||||
|
||||
@@ -64,14 +64,16 @@ class TestAddInformation:
|
||||
def test_add_and_reload_tree_at_project_root(self, ifc, document):
|
||||
document.clear_document_tree().should_be_called()
|
||||
document.get_active_breadcrumb().should_be_called().will_return(None)
|
||||
ifc.run("document.add_information", parent=None).should_be_called()
|
||||
ifc.run("document.add_information", parent=None).should_be_called().will_return("information")
|
||||
ifc.run("document.add_reference", information="information").should_be_called()
|
||||
document.import_project_documents().should_be_called()
|
||||
subject.add_information(ifc, document)
|
||||
|
||||
def test_add_and_reload_tree_at_current_parent(self, ifc, document):
|
||||
document.clear_document_tree().should_be_called()
|
||||
document.get_active_breadcrumb().should_be_called().will_return("parent")
|
||||
ifc.run("document.add_information", parent="parent").should_be_called()
|
||||
ifc.run("document.add_information", parent="parent").should_be_called().will_return("information")
|
||||
ifc.run("document.add_reference", information="information").should_be_called()
|
||||
document.import_subdocuments("parent").should_be_called()
|
||||
document.import_references("parent").should_be_called()
|
||||
subject.add_information(ifc, document)
|
||||
|
||||
Reference in New Issue
Block a user