From 78d2a6eadfcc24e40482038736b3f1f7877bc68c Mon Sep 17 00:00:00 2001 From: Cedric-Magnan Date: Wed, 12 Oct 2022 16:30:10 +0200 Subject: [PATCH] add: logs --- github_tests_validator_app/bin/github_repo_validation.py | 5 +++++ .../lib/connectors/github_connector.py | 4 ++-- github_tests_validator_app/lib/connectors/google_drive.py | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/github_tests_validator_app/bin/github_repo_validation.py b/github_tests_validator_app/bin/github_repo_validation.py index 307cce3..d0d4435 100644 --- a/github_tests_validator_app/bin/github_repo_validation.py +++ b/github_tests_validator_app/bin/github_repo_validation.py @@ -91,6 +91,8 @@ def validate_github_repo( student_github_connector: GitHubConnector, gsheet: GSheetConnector, payload: Dict[str, Any] ) -> None: + logging.info(f"Connecting to repo : {GH_TESTS_REPO_NAME}") + tests_github_connector = GitHubConnector( user=student_github_connector.user, repo_name=GH_TESTS_REPO_NAME @@ -99,6 +101,9 @@ def validate_github_repo( branch_name="main", access_token=GH_PAT, ) + + logging.info(f"Connecting to repo : {student_github_connector.repo.parent.full_name}") + original_github_connector = GitHubConnector( user=student_github_connector.user, repo_name=student_github_connector.repo.parent.full_name, diff --git a/github_tests_validator_app/lib/connectors/github_connector.py b/github_tests_validator_app/lib/connectors/github_connector.py index 726d744..78cb72a 100644 --- a/github_tests_validator_app/lib/connectors/github_connector.py +++ b/github_tests_validator_app/lib/connectors/github_connector.py @@ -35,7 +35,7 @@ def __init__( self.set_git_integration() self.set_access_token(repo_name) self.connector = Github(login_or_token=self.ACCESS_TOKEN, timeout=30) - self.repo = self.connector.get_repo(f"{self.user.LOGIN}/{repo_name}") + self.repo = self.connector.get_repo(f"{repo_name}") logging.info("Done.") def set_git_integration(self) -> None: @@ -52,7 +52,7 @@ def set_access_token(self, repo_name: str) -> None: def get_repo(self, repo_name: str) -> Repository.Repository: self.REPO_NAME = repo_name logging.info(f"Connecting to new repo: {repo_name} with user: {self.user.LOGIN} ...") - self.repo = self.connector.get_repo(f"{self.user.LOGIN}/{repo_name}") + self.repo = self.connector.get_repo(f"{repo_name}") logging.info("Done.") return self.repo diff --git a/github_tests_validator_app/lib/connectors/google_drive.py b/github_tests_validator_app/lib/connectors/google_drive.py index ccba540..fae17d2 100644 --- a/github_tests_validator_app/lib/connectors/google_drive.py +++ b/github_tests_validator_app/lib/connectors/google_drive.py @@ -97,6 +97,8 @@ def callback(request_id, response, exception): else: ids.append(response.get("id")) + logging.info(f"Sharing file {real_file_id} to : {user_email}") + batch = self.client.new_batch_http_request(callback=callback) user_permission = {"type": "user", "role": "writer", "emailAddress": user_email} batch.add(