Skip to content

Commit bddc5a1

Browse files
Add test
Signed-off-by: Vasily Pozdnyakov <[email protected]>
1 parent 177a66f commit bddc5a1

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
{
2+
"packages": [],
3+
"dependencies": [],
4+
"files": [
5+
{
6+
"path": "METADATA.bzl",
7+
"type": "file",
8+
"package_data": [
9+
{
10+
"type": "github",
11+
"namespace": null,
12+
"name": "example/example",
13+
"version": "0.0.1",
14+
"qualifiers": {},
15+
"subpath": null,
16+
"primary_language": null,
17+
"description": null,
18+
"release_date": null,
19+
"parties": [
20+
{
21+
"type": "organization",
22+
"role": "maintainer",
23+
"name": "example_org",
24+
"email": null,
25+
"url": null
26+
}
27+
],
28+
"keywords": [],
29+
"homepage_url": "https://github.com/example/example",
30+
"download_url": null,
31+
"size": null,
32+
"sha1": null,
33+
"md5": null,
34+
"sha256": null,
35+
"sha512": null,
36+
"bug_tracking_url": null,
37+
"code_view_url": null,
38+
"vcs_url": "https://github.com/example/example.git",
39+
"copyright": null,
40+
"holder": null,
41+
"declared_license_expression": null,
42+
"declared_license_expression_spdx": null,
43+
"license_detections": [],
44+
"other_license_expression": null,
45+
"other_license_expression_spdx": null,
46+
"other_license_detections": [],
47+
"extracted_license_statement": "BSD-3-Clause",
48+
"notice_text": null,
49+
"source_packages": [],
50+
"file_references": [],
51+
"is_private": "no",
52+
"is_virtual": "no",
53+
"extra_data": {
54+
"vcs_commit_hash": "deadbeef"
55+
},
56+
"dependencies": [],
57+
"repository_homepage_url": null,
58+
"repository_download_url": null,
59+
"api_data_url": null,
60+
"datasource_id": "buck_metadata",
61+
"purl": "pkg:github/example/[email protected]"
62+
}
63+
],
64+
"for_packages": [],
65+
"scan_errors": []
66+
}
67+
]
68+
}

tests/packagedcode/test_build.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@ def test_end2end_scan_can_detect_bazel(self):
3131
run_scan_click(['--package', test_file, '--json-pp', result_file])
3232
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)
3333

34+
def test_end2end_scan_can_detect_MetadataBazel(self):
35+
test_file = self.get_test_loc('metadatabzl/new-format/METADATA.bzl')
36+
expected_file = self.get_test_loc('metadatabzl/new-format/metadatabzl-expected.json')
37+
result_file = self.get_temp_file('results.json')
38+
run_scan_click(['--package', test_file, '--json-pp', result_file])
39+
check_json_scan(expected_file, result_file, regen=REGEN_TEST_FIXTURES)
40+
3441
def test_end2end_scan_can_detect_buck(self):
3542
test_file = self.get_test_loc('buck/end2end')
3643
expected_file = self.get_test_loc('buck/end2end-expected.json')

0 commit comments

Comments
 (0)