Skip to content

Commit 1be63ad

Browse files
committed
Test that null values are not summarized
Signed-off-by: Jono Yang <jyang@nexb.com>
1 parent 4ec302a commit 1be63ad

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"headers":[{"tool_name":"scancode-toolkit","tool_version":"3.0.2.post622.ca4dcb2.dirty.20190530214353","options":{"input":["samples/arch"],"--copyright":true,"--info":true,"--json":"no_null-expected.json","--license":true,"--origin-summary":true},"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":"2019-06-07T004906.744290","end_timestamp":"2019-06-07T004911.468445","message":null,"errors":[],"extra_data":{"files_count":1}}],"files":[{"path":"arch","type":"directory","name":"arch","base_name":"arch","extension":"","size":0,"date":null,"sha1":null,"md5":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,"licenses":[],"license_expressions":[],"holders":[],"copyrights":[],"authors":[],"origin_summary":{},"summarized_to":null,"files_count":1,"dirs_count":0,"size_count":28103,"scan_errors":[]},{"path":"arch/zlib.tar.gz","type":"file","name":"zlib.tar.gz","base_name":"zlib","extension":".tar.gz","size":28103,"date":"2019-04-23","sha1":"576f0ccfe534d7f5ff5d6400078d3c6586de3abd","md5":"20b2370751abfc08bb3556c1d8114b5a","mime_type":"application/x-gzip","file_type":"gzip compressed data, last modified: Wed Jul 15 02:08:19 2015, from Unix","programming_language":null,"is_binary":true,"is_text":false,"is_archive":true,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"holders":[],"copyrights":[],"authors":[],"origin_summary":{},"summarized_to":null,"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]}]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"headers":[{"tool_name":"scancode-toolkit","tool_version":"3.0.2.post622.ca4dcb2.dirty.20190530214353","options":{"input":["samples/arch"],"--copyright":true,"--info":true,"--json":"no_null.json","--license":true},"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":"2019-06-07T004635.398786","end_timestamp":"2019-06-07T004639.535534","message":null,"errors":[],"extra_data":{"files_count":1}}],"files":[{"path":"arch","type":"directory","name":"arch","base_name":"arch","extension":"","size":0,"date":null,"sha1":null,"md5":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,"licenses":[],"license_expressions":[],"holders":[],"copyrights":[],"authors":[],"files_count":1,"dirs_count":0,"size_count":28103,"scan_errors":[]},{"path":"arch/zlib.tar.gz","type":"file","name":"zlib.tar.gz","base_name":"zlib","extension":".tar.gz","size":28103,"date":"2019-04-23","sha1":"576f0ccfe534d7f5ff5d6400078d3c6586de3abd","md5":"20b2370751abfc08bb3556c1d8114b5a","mime_type":"application/x-gzip","file_type":"gzip compressed data, last modified: Wed Jul 15 02:08:19 2015, from Unix","programming_language":null,"is_binary":true,"is_text":false,"is_archive":true,"is_media":false,"is_source":false,"is_script":false,"licenses":[],"license_expressions":[],"holders":[],"copyrights":[],"authors":[],"files_count":0,"dirs_count":0,"size_count":0,"scan_errors":[]}]}

tests/scancode/test_plugin_summary.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,14 @@ def test_origin_summary_no_summary(self):
7070
with open(result_file, 'rb') as f:
7171
results = json.loads(f.read(), object_pairs_hook=OrderedDict)['files']
7272
assert expected == results
73+
74+
def test_origin_summary_no_null_values_are_summarized(self):
75+
scan_loc = self.get_test_loc('plugin_origin_summary/no-null-in-origin-summary.json')
76+
result_file = self.get_temp_file('json')
77+
expected_file = self.get_test_loc('plugin_origin_summary/no-null-in-origin-summary-expected.json')
78+
run_scan_click(['--from-json', scan_loc, '--origin-summary', '--json', result_file])
79+
with open(expected_file, 'rb') as f:
80+
expected = json.loads(f.read(), object_pairs_hook=OrderedDict)['files']
81+
with open(result_file, 'rb') as f:
82+
results = json.loads(f.read(), object_pairs_hook=OrderedDict)['files']
83+
assert expected == results

0 commit comments

Comments
 (0)