Skip to content

Commit

Permalink
Collection version expansion mappings/concepts API list view test
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Apr 1, 2022
1 parent d3fa9e0 commit fcca81f
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions core/integration_tests/tests_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,7 @@ def test_get_200(self):
sorted([mapping.url, mapping2.url])
)


class CollectionVersionConceptMappingsViewTest(OCLAPITestCase):
def test_get_200(self):
org = OrganizationFactory()
Expand Down Expand Up @@ -1703,3 +1704,50 @@ def test_get_200(self):
sorted([data['url'] for data in response.data]),
sorted([mapping.url, mapping2.url])
)


class CollectionVersionExpansionMappingsViewTest(OCLAPITestCase):
def test_get(self):
org = OrganizationFactory()
source = OrganizationSourceFactory(organization=org)
collection = OrganizationCollectionFactory(organization=org)
expansion = ExpansionFactory(collection_version=collection)
concept = ConceptFactory(parent=source)
mapping = MappingFactory(from_concept=concept, parent=source)
reference = CollectionReference(expression=concept.url, collection=collection)
reference.save()
expansion.concepts.add(concept)
reference.concepts.add(concept)
expansion.mappings.add(mapping)

response = self.client.get(collection.url + 'expansions/e1/mappings/')

self.assertEqual(response.status_code, 404)

response = self.client.get(expansion.url + 'mappings/')

self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.data), 1)

class CollectionVersionExpansionConceptsViewTest(OCLAPITestCase):
def test_get(self):
org = OrganizationFactory()
source = OrganizationSourceFactory(organization=org)
collection = OrganizationCollectionFactory(organization=org)
expansion = ExpansionFactory(collection_version=collection)
concept = ConceptFactory(parent=source)
mapping = MappingFactory(from_concept=concept, parent=source)
reference = CollectionReference(expression=concept.url, collection=collection)
reference.save()
expansion.concepts.add(concept)
reference.concepts.add(concept)
expansion.mappings.add(mapping)

response = self.client.get(collection.url + 'expansions/e1/concepts/')

self.assertEqual(response.status_code, 404)

response = self.client.get(expansion.url + 'concepts/')

self.assertEqual(response.status_code, 200)
self.assertEqual(len(response.data), 1)

0 comments on commit fcca81f

Please sign in to comment.