Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions specifyweb/backend/businessrules/tests/test_collectionobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Collectionobject,
Collectionobjecttype,
Component,
Accession,
)
from specifyweb.specify.tests.test_api import ApiTests
from specifyweb.backend.businessrules.tests.test_component import enable_unique_catnum_pref
Expand Down Expand Up @@ -31,6 +32,22 @@ def test_catalog_number_unique_in_collection(self):
catalognumber=self.collectionobjects[0].catalognumber + 'foo')
test_co.delete()

def test_add_existing_accession_to_collectionobject(self):
accession = Accession.objects.create(
accessionnumber="Test Accession",
division=self.division,
)

collection_object = Collectionobject.objects.create(
collection=self.collection,
accession=accession,
)

fetched_object = Collectionobject.objects.get(id=collection_object.id)
self.assertEqual(fetched_object.accession, accession)
self.assertEqual(fetched_object.accession.accessionnumber, "Test Accession")


def test_default_collectionobjecttype(self):
default_type = Collectionobjecttype.objects.create(
name="default type",
Expand Down
Loading