Skip to content

Commit

Permalink
tests and documentation for 'get_object_id'
Browse files Browse the repository at this point in the history
Fix #178
  • Loading branch information
HadleyKing committed Jul 27, 2023
1 parent ec26bec commit 41edd40
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_views/test_published_object_by_id.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

"""Root Object Id Testing
Tests for 'Object Found' (200) and 'Object Not Found'(404)
"""

from django.test import TestCase
from rest_framework.test import APIClient

class ObjectIdRootObjectIdTest(TestCase):
fixtures = ['tests/fixtures/test_data']

def test_seccussfull_retrieval(self):
"""200: Object returned.
"""

client = APIClient()
response = self.client.get('/BCO_000001')
self.assertEqual(response.status_code, 200)

def test_object_not_found(self):
"""404: Object not found.
"""

response = self.client.get('/BCO_001000')
self.assertEqual(response.status_code, 404)

0 comments on commit 41edd40

Please sign in to comment.