Skip to content

Commit

Permalink
Ensure test is agnostic of the order to projects in response
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankApiyo committed Jan 7, 2020
1 parent a711bd5 commit 3fe2c38
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion onadata/apps/api/tests/viewsets/test_project_viewset.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,12 @@ def test_project_list_returns_projects_for_active_users_only(self):
request.user = self.user
response = self.view(request)
self.assertEqual(len(response.data), 2)
self.assertEqual(response.data[1].get('projectid'), shared_project.id)

shared_project_in_response = False
for project in response.data:
if project.get('projectid') == shared_project.id:
shared_project_in_response = True
self.assertTrue(shared_project_in_response)

def test_projects_get(self):
self._project_create()
Expand Down

0 comments on commit 3fe2c38

Please sign in to comment.