Skip to content

fix: unit tests #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/codegen/git/clients/github_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GithubClient:
@classmethod
def from_repo_config(cls, repo_config: RepoConfig) -> Self:
gh_wrapper = cls()
gh_wrapper.read_client = gh_wrapper._create_client_for_repo(repo_config)
gh_wrapper.read_client = gh_wrapper._create_client_for_repo(repo_config) # TODO: the read/write separation isn't necessary since it's just going to use the lowside vs the highside token
gh_wrapper._write_client = gh_wrapper._create_client_for_repo(repo_config)
return gh_wrapper

Expand All @@ -37,7 +37,7 @@ def from_token(cls, token: str | None = None) -> Self:
gh_wrapper._write_client = Github(token, base_url=cls.base_url)
return gh_wrapper

def _create_client_for_repo(self, repo_config: RepoConfig) -> Github:
def _create_client_for_repo(self) -> Github:
token = get_token_for_repo_config(github_type=self.type)
return Github(token, base_url=self.base_url)

Expand Down
3 changes: 1 addition & 2 deletions src/codegen/git/configs/token.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

from codegen.git.configs.config import config
from codegen.git.schemas.github import GithubType
from codegen.git.schemas.repo_config import RepoConfig

logger = logging.getLogger(__name__)


def get_token_for_repo_config(repo_config: RepoConfig, github_type: GithubType = GithubType.GithubEnterprise) -> str:
def get_token_for_repo_config(github_type: GithubType = GithubType.GithubEnterprise) -> str:
# TODO: implement config such that we can retrieve tokens for different repos
if github_type == GithubType.GithubEnterprise:
return config.LOWSIDE_TOKEN
Expand Down
2 changes: 1 addition & 1 deletion src/codegen/git/utils/clone_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def get_authenticated_clone_url_for_repo_config(
github_type: GithubType = GithubType.GithubEnterprise,
) -> str:
git_url = get_clone_url_for_repo_config(repo, github_type)
token = get_token_for_repo_config(repo_config=repo, github_type=github_type)
token = get_token_for_repo_config(github_type=github_type)
return f"https://x-access-token:{token}@{git_url}"


Expand Down