Skip to content

Commit

Permalink
test: fix test (duplicate project JSON schema now yields 400)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Jul 18, 2024
1 parent d2b4c50 commit f2ab668
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions chord_metadata_service/chord/tests/test_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import json
from django.db.utils import IntegrityError

from django.urls import reverse
from rest_framework import status
Expand Down Expand Up @@ -187,8 +186,9 @@ def test_create_constraint(self):
data=json.dumps(self.project_json_schema_valid_payload),
content_type="application/json")
self.assertEqual(r.status_code, status.HTTP_201_CREATED)
with self.assertRaises(IntegrityError):
r_duplicate = self.client.post('/api/project_json_schemas',
data=json.dumps(self.project_json_schema_valid_payload),
content_type="application/json")
self.assertEqual(r_duplicate, status.HTTP_500_INTERNAL_SERVER_ERROR)

r_duplicate = self.client.post('/api/project_json_schemas',
data=json.dumps(self.project_json_schema_valid_payload),
content_type="application/json")
# used to be an IntegrityError raised; upgrade to DRF 3.15 made this a 400:
self.assertEqual(r_duplicate.status_code, status.HTTP_400_BAD_REQUEST)

0 comments on commit f2ab668

Please sign in to comment.