mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
20 lines
622 B
Python
20 lines
622 B
Python
import pytest
|
|
|
|
from tools.pin_github_action import ACTION_VERSION_RE
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
("s", "expected"),
|
|
(
|
|
("uses: actions/cache@v1\n", ("actions/cache", "v1")),
|
|
("uses: actions/cache@v1 # after\n", ("actions/cache", "v1")),
|
|
("uses: actions/cache@v1# after\n", ("actions/cache", "v1")),
|
|
("uses: actions/[email protected]\n", ("actions/cache", "v1.0.0")),
|
|
("uses: actions/[email protected] # after\n", ("actions/cache", "v1.0.0")),
|
|
),
|
|
)
|
|
def test_matches(s, expected):
|
|
match = ACTION_VERSION_RE.search(s)
|
|
assert match
|
|
assert (match[1], match[2]) == expected
|