Skip to content

Commit

Permalink
Add test for project dats retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
noctillion committed Aug 3, 2023
1 parent 8cdb8dc commit ca32d1c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions chord_metadata_service/chord/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def test_create_dataset(self):
self.assertEqual(Dataset.objects.count(), len(self.valid_payloads))

def test_dats(self):
self.dats_valid_payload['dats_file'] = json.dumps({})
r = self.client.post('/api/datasets', data=json.dumps(self.dats_valid_payload),
content_type="application/json")
r_invalid = self.client.post('/api/datasets', data=json.dumps(self.dats_invalid_payload),
Expand All @@ -103,6 +104,12 @@ def test_dats(self):
self.assertEqual(r_invalid.status_code, status.HTTP_400_BAD_REQUEST)
self.assertEqual(Dataset.objects.count(), 1)

dataset_id = Dataset.objects.first().identifier

url = f'/api/datasets/{dataset_id}/dats'
response = self.client.get(url)
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, json.loads(self.dats_valid_payload['dats_file']))

# TODO: Update Dataset
# TODO: Delete Dataset
Expand Down

0 comments on commit ca32d1c

Please sign in to comment.