Skip to content

Commit

Permalink
Fix test case for screening API
Browse files Browse the repository at this point in the history
The test checks for the ordering of the item returned.
The view function or the model class doesn’t have any
order specified.

This cause the tests to fail randomly on different machines.
This commit removes that ordering the check and just checks for
the availability of the ids.
  • Loading branch information
theskumar committed Aug 11, 2022
1 parent ddd00e3 commit 65445e5
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions hypha/apply/api/v1/screening/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,9 @@ def test_add_screening_status(self):
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
self.assertEqual(len(response.json()), 2)

self.assertEqual(response.json()[0]['id'], self.yes_screening_status.id)
self.assertEqual(response.json()[0]['title'], self.yes_screening_status.title)
self.assertEqual(response.json()[0]['yes'], self.yes_screening_status.yes)
self.assertEqual(response.json()[0]['default'], self.yes_screening_status.default)

self.assertEqual(response.json()[1]['id'], self.yes_default_screening_status.id)
possible_ids = [self.yes_screening_status.id, self.yes_default_screening_status.id]
self.assertIn(response.json()[0]['id'], possible_ids)
self.assertIn(response.json()[1]['id'], possible_ids)

def test_staff_can_list_submission_screening_statuses(self):
user = StaffFactory()
Expand Down

0 comments on commit 65445e5

Please sign in to comment.