mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 09:48:32 +00:00
You can now add and remove users for ownership history
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestAddPersonAndOrganisation(test.bootstrap.IFC4):
|
||||
def test_adding(self):
|
||||
person = self.file.createIfcPerson()
|
||||
organisation = self.file.createIfcOrganization()
|
||||
person_and_organisation = ifcopenshell.api.run(
|
||||
"owner.add_person_and_organisation", self.file, person=person, organisation=organisation
|
||||
)
|
||||
@@ -0,0 +1,45 @@
|
||||
import test.bootstrap
|
||||
import ifcopenshell.api
|
||||
|
||||
|
||||
class TestRemovePersonAndOrganisation(test.bootstrap.IFC4):
|
||||
def test_removing(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcPersonAndOrganization")) == 0
|
||||
|
||||
def test_deleting_actors(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
self.file.createIfcActor(GlobalId=ifcopenshell.guid.new(), TheActor=user)
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcActor")) == 0
|
||||
|
||||
def test_ensuring_document_information_should_not_be_left_in_an_invalid_set_cardinality(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
document_information = self.file.createIfcDocumentInformation(Editors=[user])
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert document_information.Editors is None
|
||||
|
||||
def test_deleting_resource_approval_relationships(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
self.file.createIfcResourceApprovalRelationship(RelatedResourceObjects=[user])
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcResourceApprovalRelationship")) == 0
|
||||
|
||||
def test_deleting_resource_constraint_relationships(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
self.file.createIfcResourceConstraintRelationship(RelatedResourceObjects=[user])
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcResourceConstraintRelationship")) == 0
|
||||
|
||||
def test_deleting_external_reference_relationships(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
self.file.createIfcExternalReferenceRelationship(RelatedResourceObjects=[user])
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcExternalReferenceRelationship")) == 0
|
||||
|
||||
def test_deleting_owner_history(self):
|
||||
user = self.file.createIfcPersonAndOrganization()
|
||||
self.file.createIfcOwnerHistory(OwningUser=user)
|
||||
ifcopenshell.api.run("owner.remove_person_and_organisation", self.file, person_and_organisation=user)
|
||||
assert len(self.file.by_type("IfcOwnerHistory")) == 0
|
||||
Reference in New Issue
Block a user