Skip to content

Commit

Permalink
tests: covers sha verification function (#8767)
Browse files Browse the repository at this point in the history
  • Loading branch information
girol authored Dec 9, 2023
1 parent 6f9de73 commit 81e76c2
Showing 1 changed file with 26 additions and 0 deletions.
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

0 comments on commit 81e76c2

Please sign in to comment.