-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Keshav Priyadarshi <[email protected]>
- Loading branch information
1 parent
d139fc7
commit 662ddcb
Showing
3 changed files
with
58 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# Portions Copyright (c) The Python Software Foundation | ||
# VulnerableCode is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 and Python-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/vulnerablecode for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
import pytest | ||
|
||
from aboutcode.hashid import package_path_elements | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"purl, purl_hash", | ||
[ | ||
("pkg:maven/org.apache.commons/io", "4f"), | ||
("pkg:GOLANG/google.golang.org/genproto@abcdedf#/googleapis/api/annotations/", "4a"), | ||
("pkg:golang/github.com/nats-io/nats-server/v2/[email protected]", "22"), | ||
("pkg:bitbucket/birKenfeld/pyGments-main@244fd47e07d1014f0aed9c", "03"), | ||
("pkg:github/Package-url/purl-Spec@244fd47e07d1004f0aed9c", "095"), | ||
("pkg:deb/debian/[email protected]?arch=i386&distro=jessie", "19"), | ||
( | ||
"pkg:docker/customer/dockerimage@sha256:244fd47e07d1004f0aed9c?repository_url=gcr.io", | ||
"10", | ||
), | ||
("pkg:gem/[email protected]?Platform=java", "1e"), | ||
( | ||
"pkg:Maven/org.apache.xmlgraphics/[email protected]?repositorY_url=repo.spring.io/release&classifier=sources", | ||
"28", | ||
), | ||
( | ||
"pkg:Maven/org.apache.xmlgraphics/[email protected]?repositorY_url=repo.spring.io/release&extension=pom", | ||
"28", | ||
), | ||
("pkg:Maven/net.sf.jacob-project/[email protected]?type=dll&classifier=x86", "17"), | ||
("pkg:npm/%40angular/[email protected]", "323"), | ||
("pkg:Nuget/[email protected]", "63"), | ||
("pkg:PYPI/[email protected]", "00"), | ||
("pkg:composer/guzzlehttp/[email protected]", "1d"), | ||
("pkg:Rpm/fedora/[email protected]?Arch=i386&Distro=fedora-25", "16"), | ||
("pkg:maven/HTTPClient/[email protected]", "4d"), | ||
("pkg:maven/mygroup/[email protected]%20Final?mykey=my%20value", "6f"), | ||
("pkg:npm/@babel/core#/googleapis/api/annotations/", "0dc"), | ||
("pkg:npm/@babel/[email protected]#/googleapis/api/annotations/", "0dc"), | ||
("pkg:npm/[email protected]#/googleapis/api/annotations/", "23b"), | ||
("pkg:npm/core#/googleapis/api/annotations/", "23b"), | ||
], | ||
) | ||
def test_purl_hash(purl, purl_hash): | ||
result_hash, *_ = package_path_elements(purl) | ||
assert result_hash == purl_hash |
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