From 65445e5eff3fe7b5695d7353e40d89207be6313c Mon Sep 17 00:00:00 2001
From: Saurabh Kumar <theskumar@users.noreply.github.com>
Date: Thu, 11 Aug 2022 09:40:31 +0530
Subject: [PATCH] Fix test case for screening API
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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.
---
 hypha/apply/api/v1/screening/tests/test_views.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/hypha/apply/api/v1/screening/tests/test_views.py b/hypha/apply/api/v1/screening/tests/test_views.py
index 54fe3c359..33c1e1ae1 100644
--- a/hypha/apply/api/v1/screening/tests/test_views.py
+++ b/hypha/apply/api/v1/screening/tests/test_views.py
@@ -131,12 +131,9 @@ class SubmissionScreeningStatusViewSetTests(APITestCase):
         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()
-- 
GitLab