From 1b03cc3a8faf7b94910a6216732ec5f4f44e63a1 Mon Sep 17 00:00:00 2001 From: Suejung Shin Date: Thu, 9 Jan 2025 14:30:32 -0800 Subject: [PATCH] add test --- graphql_api/tests/test_owner.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/graphql_api/tests/test_owner.py b/graphql_api/tests/test_owner.py index 25a5b3ae23..b626a07da6 100644 --- a/graphql_api/tests/test_owner.py +++ b/graphql_api/tests/test_owner.py @@ -806,6 +806,26 @@ def test_fetch_owner_on_unauthenticated_enteprise_guest_access_not_activated(sel assert e.message == UnauthorizedGuestAccess.message assert e.extensions["code"] == UnauthorizedGuestAccess.code + @override_settings(IS_ENTERPRISE=True, GUEST_ACCESS=False) + def test_fetch_owner_plan_activated_users_is_none(self): + """ + This test is when Enterprise guest access is disabled, and you are + trying to view an org that does not track plan activated users (e.g., historic data) + """ + user = OwnerFactory(username="sample-user") + owner = OwnerFactory(username="sample-owner", plan_activated_users=None) + user.save() + owner.save() + query = """{ + owner(username: "%s") { + username + } + } + """ % (owner.username) + + data = self.gql_request(query, owner=user) + assert data["owner"]["username"] == "sample-owner" + def test_fetch_current_user_is_okta_authenticated(self): account = AccountFactory() owner = OwnerFactory(username="sample-owner", service="github", account=account)