generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: differentiate abstract purl type; move regex escape call to mo…
…re suitable location Signed-off-by: Ben Selwyn-Smith <[email protected]>
- Loading branch information
Showing
2 changed files
with
17 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ | |
from packageurl import PackageURL | ||
|
||
from macaron.repo_finder import commit_finder | ||
from macaron.repo_finder.commit_finder import PurlType | ||
from macaron.repo_finder.commit_finder import AbstractPurlType | ||
from tests.slsa_analyzer.mock_git_utils import commit_files, initiate_repo | ||
|
||
logger: logging.Logger = logging.getLogger(__name__) | ||
|
@@ -62,7 +62,7 @@ def _test_version(tags: list[str], name: str, version: str, target_tag: str) -> | |
"pkg:nuget/[email protected]", | ||
"pkg:cargo/[email protected]", | ||
], | ||
PurlType.ARTIFACT, | ||
AbstractPurlType.ARTIFACT, | ||
id="Artifact PURLs", | ||
), | ||
pytest.param( | ||
|
@@ -71,20 +71,20 @@ def _test_version(tags: list[str], name: str, version: str, target_tag: str) -> | |
"pkg:github/oracle/[email protected]", | ||
"pkg:bitbucket/owner/project@tag_5", | ||
], | ||
PurlType.REPOSITORY, | ||
AbstractPurlType.REPOSITORY, | ||
id="Repository PURLs", | ||
), | ||
pytest.param( | ||
["pkg:gem/[email protected]", "pkg:unknown-domain/project/owner@tag"], | ||
PurlType.UNSUPPORTED, | ||
AbstractPurlType.UNSUPPORTED, | ||
id="Unsupported PURLs", | ||
), | ||
], | ||
) | ||
def test_abstract_purl_type(purls: list[str], expected: PurlType) -> None: | ||
def test_abstract_purl_type(purls: list[str], expected: AbstractPurlType) -> None: | ||
"""Test each purl in list is of expected type.""" | ||
for purl in purls: | ||
assert commit_finder.abstract_purl_type(PackageURL.from_string(purl)) == expected | ||
assert commit_finder.determine_abstract_purl_type(PackageURL.from_string(purl)) == expected | ||
|
||
|
||
def test_commit_finder() -> None: | ||
|