Skip to content

Commit

Permalink
Use less paths for test expectations #180
Browse files Browse the repository at this point in the history
Signed-off-by: Jono Yang <[email protected]>
  • Loading branch information
JonoYang committed May 11, 2022
1 parent d4cfac2 commit 06acd33
Show file tree
Hide file tree
Showing 2 changed files with 158 additions and 19 deletions.
153 changes: 153 additions & 0 deletions scanpipe/tests/data/is-npm-1.0.0_scancode_scan.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
{
"headers": [
{
"tool_name": "scancode-toolkit",
"tool_version": "30.1.0",
"options": {
"input": [
"."
],
"--info": true,
"--json-pp": "../is-npm-1.0.0_scancode_scan.json"
},
"notice": "Generated with ScanCode and provided on an \"AS IS\" BASIS, WITHOUT WARRANTIES\nOR CONDITIONS OF ANY KIND, either express or implied. No content created from\nScanCode should be considered or used as legal advice. Consult an Attorney\nfor any legal advice.\nScanCode is a free software code scanning tool from nexB Inc. and others.\nVisit https://github.com/nexB/scancode-toolkit/ for support and download.",
"start_timestamp": "2021-12-15T212542.730596",
"end_timestamp": "2021-12-15T212542.844045",
"output_format_version": "1.0.0",
"duration": 0.11346149444580078,
"message": null,
"errors": [],
"extra_data": {
"spdx_license_list_version": "3.14",
"files_count": 3
}
}
],
"files": [
{
"path": "is-npm-1.0.0.tgz-extract",
"type": "directory",
"name": "is-npm-1.0.0.tgz-extract",
"base_name": "is-npm-1.0.0.tgz-extract",
"extension": "",
"size": 0,
"date": null,
"sha1": null,
"md5": null,
"sha256": null,
"mime_type": null,
"file_type": null,
"programming_language": null,
"is_binary": false,
"is_text": false,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"files_count": 3,
"dirs_count": 1,
"size_count": 1187,
"scan_errors": []
},
{
"path": "is-npm-1.0.0.tgz-extract/package",
"type": "directory",
"name": "package",
"base_name": "package",
"extension": "",
"size": 0,
"date": null,
"sha1": null,
"md5": null,
"sha256": null,
"mime_type": null,
"file_type": null,
"programming_language": null,
"is_binary": false,
"is_text": false,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"files_count": 3,
"dirs_count": 0,
"size_count": 1187,
"scan_errors": []
},
{
"path": "is-npm-1.0.0.tgz-extract/package/index.js",
"type": "file",
"name": "index.js",
"base_name": "index",
"extension": ".js",
"size": 147,
"date": "2014-07-20",
"sha1": "ecce1fc677fa7d20fc5593b63db45e45c5e8768a",
"md5": "bc4b18b0c8c32b94883d6fc1d675e919",
"sha256": "4044efe5626e2fbc40d3d7ce8b263b831d7644ac179e20cdf15b2794f8934030",
"mime_type": "text/plain",
"file_type": "ASCII text",
"programming_language": "JavaScript",
"is_binary": false,
"is_text": true,
"is_archive": false,
"is_media": false,
"is_source": true,
"is_script": false,
"files_count": 0,
"dirs_count": 0,
"size_count": 0,
"scan_errors": []
},
{
"path": "is-npm-1.0.0.tgz-extract/package/package.json",
"type": "file",
"name": "package.json",
"base_name": "package",
"extension": ".json",
"size": 563,
"date": "2014-07-20",
"sha1": "943efb8abda9b9cdaa4ea73f5709563b948af50b",
"md5": "c843e88ecb274d5d573c71be330bff8b",
"sha256": "522879426298e078881de533b9b3a82fa3bece1336a84bddacf4620008b5d0a3",
"mime_type": "application/json",
"file_type": "JSON data",
"programming_language": null,
"is_binary": false,
"is_text": true,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"files_count": 0,
"dirs_count": 0,
"size_count": 0,
"scan_errors": []
},
{
"path": "is-npm-1.0.0.tgz-extract/package/readme.md",
"type": "file",
"name": "readme.md",
"base_name": "readme",
"extension": ".md",
"size": 477,
"date": "2014-07-20",
"sha1": "b77832e53cb8239edd733c2ca02b1fc01ca3c2b6",
"md5": "a743e0abf08c28a37ecc4bef4dc02f8c",
"sha256": "e98b263545fe62a00c73b57412cbdbcd0792e013a76f9c88342623ab5e8467c1",
"mime_type": "text/plain",
"file_type": "UTF-8 Unicode text",
"programming_language": null,
"is_binary": false,
"is_text": true,
"is_archive": false,
"is_media": false,
"is_source": false,
"is_script": false,
"files_count": 0,
"dirs_count": 0,
"size_count": 0,
"scan_errors": []
}
]
}
24 changes: 5 additions & 19 deletions scanpipe/tests/test_pipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,31 +611,17 @@ def test_scanpipe_pipes_scancode_make_results_summary(self):
self.assertEqual(10, len(summary.keys()))

def test_scanpipe_pipes_scancode_replace_root_path_and_name(self):
input_location = self.data_location / "asgiref-3.3.0_scan.json"
input_location = self.data_location / "is-npm-1.0.0_scancode_scan.json"
virtual_codebase = VirtualCodebase(location=input_location)
virtual_codebase_root_replaced = scancode.replace_root_path_and_name(
virtual_codebase
)
expected_topdown_paths = [
".",
"asgiref-3.3.0-py3-none-any.whl",
"asgiref-3.3.0-py3-none-any.whl-extract",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/__init__.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/compatibility.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/current_thread_executor.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/local.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/server.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/sync.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/testing.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/timeout.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref/wsgi.py",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/LICENSE",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/METADATA",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/RECORD",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/top_level.txt",
"asgiref-3.3.0-py3-none-any.whl-extract/asgiref-3.3.0.dist-info/WHEEL",
"package",
"package/index.js",
"package/package.json",
"package/readme.md",
]
results = [
resource.path
Expand Down

0 comments on commit 06acd33

Please sign in to comment.