Adding a document now auto adds a reference for convenience.

This commit is contained in:
Dion Moult
2022-03-30 18:15:26 +11:00
parent a0c8d87ad0
commit e38184b152
2 changed files with 6 additions and 3 deletions
+2 -1
View File
@@ -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)
+4 -2
View File
@@ -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)