Skip to content

Commit

Permalink
feat: added test
Browse files Browse the repository at this point in the history
  • Loading branch information
joydeep049 committed Jan 1, 2025
1 parent acfd915 commit 747d1f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/gitingest/parse_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def _parse_url(url: str) -> dict[str, Any]:
_id = str(uuid.uuid4())
slug = f"{user_name}-{repo_name}"

final_url = f"https://{domain}/{user_name}/{repo_name}" if url.startswith("https://") else f"http://{domain}/{user_name}/{repo_name}"
parsed = {
"user_name": user_name,
"repo_name": repo_name,
Expand All @@ -124,7 +125,7 @@ def _parse_url(url: str) -> dict[str, Any]:
"commit": None,
"subpath": "/",
"local_path": f"{TMP_BASE_PATH}/{_id}/{slug}",
"url": f"https://{domain}/{user_name}/{repo_name}",
"url": final_url,
"slug": slug,
"id": _id,
}
Expand Down
1 change: 1 addition & 0 deletions src/gitingest/tests/test_parse_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def test_parse_url_valid() -> None:
"https://github.com/user/repo",
"https://gitlab.com/user/repo",
"https://bitbucket.org/user/repo",
"http://github.com/user/repo",
]
for url in test_cases:
result = _parse_url(url)
Expand Down

0 comments on commit 747d1f8

Please sign in to comment.