This repository has been archived by the owner on Apr 26, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow cloning with custom git depth (#40)
- Loading branch information
Showing
3 changed files
with
42 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -146,6 +146,29 @@ class p: | |
] | ||
assert mock.await_args[0][0][: len(expected_cmd)] == expected_cmd | ||
|
||
async def test_cloning_with_custom_depth(self, monkeypatch): | ||
"""Ensure that we can retrieve the whole history, i.e. support true git clone""" # noqa: E501 | ||
|
||
class p: | ||
returncode = 0 | ||
|
||
mock = AsyncMock(return_value=p()) | ||
monkeypatch.setattr(prefect_gitlab.repositories, "run_process", mock) | ||
repo = "[email protected]:PrefectHQ/prefect.git" | ||
depth = None | ||
g = GitLabRepository( | ||
repository=repo, | ||
git_depth=depth, | ||
) | ||
await g.get_directory() | ||
assert mock.await_count == 1 | ||
expected_cmd = [ | ||
"git", | ||
"clone", | ||
repo, | ||
] | ||
assert mock.await_args[0][0][: len(expected_cmd)] == expected_cmd | ||
|
||
async def test_ssh_fails_with_credential(self, monkeypatch): | ||
"""Ensure that credentials cannot be passed in if the URL is not in the HTTPS/HTTP | ||
format. | ||
|