Skip to content

Commit f9553ca

Browse files
committed
squash!: Add test for inactive orgs
1 parent 56f93b3 commit f9553ca

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

openedx_authz/tests/rest_api/test_views.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,22 @@ def test_get_orgs_response_shape(self):
952952
self.assertIn("name", result)
953953
self.assertIn("short_name", result)
954954

955+
def test_get_orgs_excludes_inactive(self):
956+
"""Test that inactive orgs are not returned.
957+
958+
Expected result:
959+
- Returns 200 OK status
960+
- Inactive orgs are excluded from results
961+
"""
962+
Organization.objects.create(name="Inactive Org", short_name="InactiveO", active=False)
963+
964+
response = self.client.get(self.url)
965+
966+
self.assertEqual(response.status_code, status.HTTP_200_OK)
967+
self.assertEqual(response.data["count"], 3)
968+
result_names = [org["name"] for org in response.data["results"]]
969+
self.assertNotIn("Inactive Org", result_names)
970+
955971
def test_get_orgs_unauthenticated(self):
956972
"""Test that unauthenticated requests are rejected.
957973

0 commit comments

Comments
 (0)