Skip to content

Commit e332074

Browse files
Modify tests to ignore headers
Modifies tests to ignore addition of output data format in headers. Signed-off-by: Ayan Sinha Mahapatra <ayansmahapatra@gmail.com>
1 parent 2a00b47 commit e332074

9 files changed

Lines changed: 62 additions & 62 deletions

File tree

tests/cluecode/test_plugin_email_url.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,28 @@ def test_scan_email():
2525
result_file = test_env.get_temp_file('json')
2626
args = ['--email', '--strip-root', test_dir, '--json', result_file]
2727
run_scan_click(args)
28-
check_json_scan(test_env.get_test_loc('plugin_email_url/emails.expected.json'), result_file)
28+
check_json_scan(test_env.get_test_loc('plugin_email_url/emails.expected.json'), result_file, ignore_headers=True)
2929

3030

3131
def test_scan_email_with_threshold():
3232
test_dir = test_env.get_test_loc('plugin_email_url/files')
3333
result_file = test_env.get_temp_file('json')
3434
args = ['--email', '--strip-root', '--max-email', '2', test_dir, '--json', result_file]
3535
run_scan_click(args)
36-
check_json_scan(test_env.get_test_loc('plugin_email_url/emails-threshold.expected.json'), result_file)
36+
check_json_scan(test_env.get_test_loc('plugin_email_url/emails-threshold.expected.json'), result_file, ignore_headers=True)
3737

3838

3939
def test_scan_url():
4040
test_dir = test_env.get_test_loc('plugin_email_url/files')
4141
result_file = test_env.get_temp_file('json')
4242
args = ['--url', '--strip-root', test_dir, '--json', result_file]
4343
run_scan_click(args)
44-
check_json_scan(test_env.get_test_loc('plugin_email_url/urls.expected.json'), result_file)
44+
check_json_scan(test_env.get_test_loc('plugin_email_url/urls.expected.json'), result_file, ignore_headers=True)
4545

4646

4747
def test_scan_url_with_threshold():
4848
test_dir = test_env.get_test_loc('plugin_email_url/files')
4949
result_file = test_env.get_temp_file('json')
5050
args = ['--url', '--strip-root', '--max-url', '2', test_dir, '--json', result_file]
5151
run_scan_click(args)
52-
check_json_scan(test_env.get_test_loc('plugin_email_url/urls-threshold.expected.json'), result_file)
52+
check_json_scan(test_env.get_test_loc('plugin_email_url/urls-threshold.expected.json'), result_file, ignore_headers=True)

tests/cluecode/test_plugin_ignore_copyrights.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def test_ignore_holders(self):
3737
result_file = self.get_temp_file('json')
3838
expected_file = self.get_test_loc('plugin_ignore_copyrights/holders.expected.json')
3939
run_scan_click(['-c', '--ignore-copyright-holder', 'Regents', '--json-pp', result_file, test_dir])
40-
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False)
40+
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False, ignore_headers=True)
4141

4242
def test_ignore_authors(self):
4343
test_dir = self.extract_test_tar('plugin_ignore_copyrights/basic.tgz')
4444
result_file = self.get_temp_file('json')
4545
expected_file = self.get_test_loc('plugin_ignore_copyrights/authors.expected.json')
4646
run_scan_click(['-c', '--ignore-author', 'Berkeley', '--json-pp', result_file, test_dir])
47-
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False)
47+
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False, ignore_headers=True)

tests/formattedcode/test_output_json.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def test_json_pretty_print():
2727
args = ['-clip', test_dir, '--json-pp', result_file]
2828
run_scan_click(args)
2929
expected = test_env.get_test_loc('json/simple-expected.jsonpp')
30-
check_json_scan(expected, result_file, remove_file_date=True, regen=False)
30+
check_json_scan(expected, result_file, remove_file_date=True, regen=False, ignore_headers=True)
3131

3232

3333
def test_json_compact():
@@ -37,7 +37,7 @@ def test_json_compact():
3737
with open(result_file, 'rb') as res:
3838
assert len(res.read().splitlines()) == 1
3939
expected = test_env.get_test_loc('json/simple-expected.json')
40-
check_json_scan(expected, result_file, remove_file_date=True, regen=False)
40+
check_json_scan(expected, result_file, remove_file_date=True, regen=False, ignore_headers=True)
4141

4242

4343
@pytest.mark.scanslow
@@ -46,7 +46,7 @@ def test_scan_output_does_not_truncate_copyright_json():
4646
result_file = test_env.get_temp_file('test.json')
4747
run_scan_click(['-clip', '--strip-root', test_dir, '--json-pp', result_file])
4848
expected = test_env.get_test_loc('json/tree/expected.json')
49-
check_json_scan(expected, result_file, remove_file_date=True, regen=False)
49+
check_json_scan(expected, result_file, remove_file_date=True, regen=False, ignore_headers=True)
5050

5151

5252
@pytest.mark.scanslow
@@ -56,7 +56,7 @@ def test_scan_output_does_not_truncate_copyright_with_json_to_stdout():
5656
args = ['-clip', '--strip-root', test_dir, '--json-pp', result_file]
5757
run_scan_click(args)
5858
expected = test_env.get_test_loc('json/tree/expected.json')
59-
check_json_scan(expected, result_file, remove_file_date=True, regen=False)
59+
check_json_scan(expected, result_file, remove_file_date=True, regen=False, ignore_headers=True)
6060

6161

6262
@pytest.mark.scanslow

tests/formattedcode/test_output_jsonlines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def test_jsonlines():
2828
expected = test_env.get_test_loc('json/simple-expected.jsonlines')
2929
check_jsonlines_scan(
3030
test_env.get_test_loc(expected), result_file,
31-
remove_file_date=True, regen=False)
31+
remove_file_date=True, regen=False, ignore_headers=True)
3232

3333

3434
def test_jsonlines_with_timing():

tests/licensedcode/test_plugin_license.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_license_option_reports_license_expressions():
2929
args = ['--license', '--strip-root', test_dir, '--json', result_file, '--verbose']
3030
run_scan_click(args)
3131
test_loc = test_env.get_test_loc('plugin_license/license-expression/scan.expected.json')
32-
check_json_scan(test_loc, result_file, regen=False)
32+
check_json_scan(test_loc, result_file, regen=False, ignore_headers=True)
3333

3434

3535
def test_license_option_reports_license_texts():
@@ -38,7 +38,7 @@ def test_license_option_reports_license_texts():
3838
args = ['--license', '--license-text', '--strip-root', test_dir, '--json', result_file, '--verbose']
3939
run_scan_click(args)
4040
test_loc = test_env.get_test_loc('plugin_license/text/scan.expected.json')
41-
check_json_scan(test_loc, result_file, regen=False)
41+
check_json_scan(test_loc, result_file, regen=False, ignore_headers=True)
4242

4343

4444
def test_license_option_reports_license_texts_diag():
@@ -47,7 +47,7 @@ def test_license_option_reports_license_texts_diag():
4747
args = ['--license', '--license-text', '--license-text-diagnostics', '--strip-root', test_dir, '--json', result_file, '--verbose']
4848
run_scan_click(args)
4949
test_loc = test_env.get_test_loc('plugin_license/text/scan-diag.expected.json')
50-
check_json_scan(test_loc, result_file, regen=False)
50+
check_json_scan(test_loc, result_file, regen=False, ignore_headers=True)
5151

5252

5353
def test_license_option_reports_license_texts_long_lines():
@@ -56,7 +56,7 @@ def test_license_option_reports_license_texts_long_lines():
5656
args = ['--license', '--license-text', '--strip-root', test_dir, '--json', result_file, '--verbose']
5757
run_scan_click(args)
5858
test_loc = test_env.get_test_loc('plugin_license/text_long_lines/scan.expected.json')
59-
check_json_scan(test_loc, result_file, regen=False)
59+
check_json_scan(test_loc, result_file, regen=False, ignore_headers=True)
6060

6161

6262
def test_license_option_reports_license_texts_diag_long_lines():
@@ -65,7 +65,7 @@ def test_license_option_reports_license_texts_diag_long_lines():
6565
args = ['--license', '--license-text', '--license-text-diagnostics', '--strip-root', test_dir, '--json', result_file, '--verbose']
6666
run_scan_click(args)
6767
test_loc = test_env.get_test_loc('plugin_license/text_long_lines/scan-diag.expected.json')
68-
check_json_scan(test_loc, result_file, regen=False)
68+
check_json_scan(test_loc, result_file, regen=False, ignore_headers=True)
6969

7070

7171
def test_reindex_licenses_works():
@@ -81,7 +81,7 @@ def test_scan_license_with_url_template():
8181
test_dir, '--json-pp', result_file]
8282
test_loc = test_env.get_test_loc('plugin_license/license_url.expected.json')
8383
run_scan_click(args)
84-
check_json_scan(test_loc, result_file)
84+
check_json_scan(test_loc, result_file, ignore_headers=True)
8585

8686

8787
@pytest.mark.scanslow
@@ -91,7 +91,7 @@ def test_detection_does_not_timeout_on_sqlite3_amalgamation():
9191
expected_file = test_env.get_test_loc('plugin_license/sqlite/sqlite.expected.json')
9292
# we use the default 120 seconds timeout
9393
run_scan_click(['-l', '--license-text', '--json-pp', result_file, test_dir])
94-
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False)
94+
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False, ignore_headers=True)
9595

9696

9797
@pytest.mark.scanslow
@@ -100,4 +100,4 @@ def test_detection_is_correct_in_legacy_npm_package_json():
100100
result_file = test_env.get_temp_file('json')
101101
expected_file = test_env.get_test_loc('plugin_license/package/package.expected.json')
102102
run_scan_click(['-lp', '--json-pp', result_file, test_dir])
103-
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False)
103+
check_json_scan(expected_file, result_file, remove_file_date=True, regen=False, ignore_headers=True)

tests/licensedcode/test_plugin_license_text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ def test_is_licensing_works():
3333
test_dir, '--json-pp', result_file, '--verbose']
3434
run_scan_click(args)
3535
check_json_scan(test_env.get_test_loc('plugin_license_text/scan.expected.json'),
36-
result_file, remove_file_date=True, regen=False)
36+
result_file, remove_file_date=True, regen=False, ignore_headers=True)

tests/packagedcode/test_build.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ def test_end2end_scan_can_detect_bazel(self):
2525
expected_file = self.get_test_loc('bazel/end2end-expected.json')
2626
result_file = self.get_temp_file('results.json')
2727
run_scan_click(['--package', test_file, '--json-pp', result_file])
28-
check_json_scan(expected_file, result_file, regen=False)
28+
check_json_scan(expected_file, result_file, regen=False, ignore_headers=True)
2929

3030
def test_end2end_scan_can_detect_buck(self):
3131
test_file = self.get_test_loc('buck/end2end')
3232
expected_file = self.get_test_loc('buck/end2end-expected.json')
3333
result_file = self.get_temp_file('results.json')
3434
run_scan_click(['--package', test_file, '--json-pp', result_file])
35-
check_json_scan(expected_file, result_file, regen=False)
35+
check_json_scan(expected_file, result_file, regen=False, ignore_headers=True)
3636

3737
def test_build_get_package_resources(self):
3838
test_loc = self.get_test_loc('get_package_resources')

0 commit comments

Comments
 (0)