-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: covers sha verification function (#8767)
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from __future__ import annotations | ||
|
||
from poetry.vcs.git.backend import is_revision_sha | ||
|
||
|
||
VALID_SHA = "c5c7624ef64f34d9f50c3b7e8118f7f652fddbbd" | ||
|
||
|
||
def test_invalid_revision_sha() -> None: | ||
result = is_revision_sha("invalid_input") | ||
assert result is False | ||
|
||
|
||
def test_valid_revision_sha() -> None: | ||
result = is_revision_sha(VALID_SHA) | ||
assert result is True | ||
|
||
|
||
def test_invalid_revision_sha_min_len() -> None: | ||
result = is_revision_sha("c5c7") | ||
assert result is False | ||
|
||
|
||
def test_invalid_revision_sha_max_len() -> None: | ||
result = is_revision_sha(VALID_SHA + "42") | ||
assert result is False |