diff --git a/config.py b/config.py index f3786292..80c4f3de 100644 --- a/config.py +++ b/config.py @@ -104,6 +104,6 @@ def get_env_var(name: str) -> str: EXCEPTION_OWNERS = ["gitautoai", "hiroshinishio"] OWNER_TYPE = "Organization" TEST_EMAIL = "test@gitauto.ai" -UNIQUE_ISSUE_ID = "O/gitautoai/test#1" +TEST_REPO_NAME = "test-repo" USER_ID = -1 USER_NAME = "username-test" diff --git a/tests/services/supabase/test_users_manager.py b/tests/services/supabase/test_users_manager.py index 8e69d655..a5679cee 100644 --- a/tests/services/supabase/test_users_manager.py +++ b/tests/services/supabase/test_users_manager.py @@ -13,9 +13,9 @@ USER_ID, USER_NAME, INSTALLATION_ID, - UNIQUE_ISSUE_ID, NEW_INSTALLATION_ID, TEST_EMAIL, + TEST_REPO_NAME, ) from services.stripe.customer import get_subscription from services.supabase import SupabaseManager @@ -102,19 +102,18 @@ def test_how_many_requests_left() -> None: assert request_count == 5 assert isinstance(end_date, datetime.datetime) - supabase_manager.client.table("issues").insert( - json={ - "installation_id": INSTALLATION_ID, - "unique_id": UNIQUE_ISSUE_ID, - } - ).execute() - for _ in range(1, 6): + # Generate 5 issues and 5 usage records + for i in range(1, 6): + unique_issue_id: str = f"{OWNER_TYPE}/{OWNER_NAME}/{TEST_REPO_NAME}#{i}" + supabase_manager.client.table("issues").insert( + json={"installation_id": INSTALLATION_ID, "unique_id": unique_issue_id} + ).execute() supabase_manager.client.table("usage").insert( json={ "user_id": USER_ID, "installation_id": INSTALLATION_ID, "is_completed": True, - "unique_issue_id": UNIQUE_ISSUE_ID, + "unique_issue_id": unique_issue_id, } ).execute()