Skip to content
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

tests: covers sha verification function #8767

Merged
merged 1 commit into from
Dec 9, 2023
Merged
Changes from all commits
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
26 changes: 26 additions & 0 deletions tests/vcs/git/test_backend.py
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