Skip to content

Commit

Permalink
Merge pull request #84 from gitautoai/kan-176-owner-type
Browse files Browse the repository at this point in the history
Remove ommitance of owner type
  • Loading branch information
nikitamalinov authored Apr 25, 2024
2 parents 5afb72d + bc8c539 commit 4bcd682
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ def get_env_var(name: str) -> str:
USER_ID = -1
INSTALLATION_ID = -1
OWNER_NAME = "installation-test"
OWNER_TYPE = "O"
OWNER_TYPE = "Organization"
USER_NAME = "username-test"
UNIQUE_ISSUE_ID = "O/gitautoai/test#1"
2 changes: 1 addition & 1 deletion services/gitauto_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ async def handle_gitauto(payload: GitHubLabeledPayload, trigger_type: str) -> No
issue_number: int = issue["number"]
installation_id: int = payload["installation"]["id"]
repo: RepositoryInfo = payload["repository"]
owner_type = payload["repository"]["owner"]["type"][0]
owner_type = payload["repository"]["owner"]["type"]
owner: str = repo["owner"]["login"]
owner_id: int = repo["owner"]["id"]
repo_name: str = repo["name"]
Expand Down
4 changes: 2 additions & 2 deletions services/webhook_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
async def handle_installation_created(payload: GitHubInstallationPayload) -> None:
"""Creates installation records on GitAuto APP installation"""
installation_id: int = payload["installation"]["id"]
owner_type: str = payload["installation"]["account"]["type"][0]
owner_type: str = payload["installation"]["account"]["type"]
owner_name: str = payload["installation"]["account"]["login"]
owner_id: int = payload["installation"]["account"]["id"]
user_id: int = payload["sender"]["id"]
Expand Down Expand Up @@ -111,6 +111,6 @@ async def handle_webhook_event(event_name: str, payload: GitHubEventPayload) ->
if not match:
return
issue_number = match.group(1)
owner_type = payload["repository"]["owner"]["type"][0]
owner_type = payload["repository"]["owner"]["type"]
unique_issue_id = f"{owner_type}/{payload['repository']['owner']['login']}/{payload['repository']['name']}#{issue_number}"
supabase_manager.set_issue_to_merged(unique_issue_id=unique_issue_id)
6 changes: 3 additions & 3 deletions tests/services/supabase/test_gitauto_manager.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# run this file locally with: python -m tests.services.supabase.test_gitauto_manager
import os

from config import OWNER_TYPE
from services.supabase import SupabaseManager

SUPABASE_SERVICE_ROLE_KEY = os.getenv("SUPABASE_SERVICE_ROLE_KEY")
Expand Down Expand Up @@ -40,7 +40,7 @@ def test_create_update_user_request_works() -> None:
# insert data into the db -> create installation
supabase_manager.create_installation(
installation_id=installation_id,
owner_type="O",
owner_type=OWNER_TYPE,
owner_name="gitautoai",
owner_id=-1,
user_id=user_id,
Expand Down Expand Up @@ -87,7 +87,7 @@ def test_complete_and_update_usage_record_only_updates_one_record() -> None:
# insert data into the db -> create installation
supabase_manager.create_installation(
installation_id=installation_id,
owner_type="O",
owner_type=OWNER_TYPE,
owner_name="gitautoai",
owner_id=-1,
user_id=user_id,
Expand Down

0 comments on commit 4bcd682

Please sign in to comment.