Skip to content

Commit 2a3b647

Browse files
committed
add tests
Signed-off-by: uttam282005 <uttam282005@gmail.com>
1 parent 9ee0b38 commit 2a3b647

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

tests/formattedcode/test_output_templated.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,46 @@ def test_paths_are_posix_in_html_format_output():
7272
assert '/copyright_acme_c-c.c' in results
7373
assert __version__ in results
7474

75+
@pytest.mark.scanslow
76+
def test_html_output_includes_license_text():
77+
test_file = test_env.get_test_loc('templated/simple-license.txt')
78+
result_file = test_env.get_temp_file('html')
79+
run_scan_click(['--license', '--license-text', test_file, '--html', result_file])
80+
results = open(result_file).read()
81+
assert 'matched text' in results.lower()
82+
assert '<pre>' in results # Check for formatted text display
83+
assert __version__ in results
84+
85+
@pytest.mark.scanslow
86+
def test_html_output_includes_license_text_diagnostics():
87+
test_file = test_env.get_test_loc('templated/simple-license.txt')
88+
result_file = test_env.get_temp_file('html')
89+
run_scan_click(['--license', '--license-text', '--license-text-diagnostics',
90+
test_file, '--html', result_file])
91+
results = open(result_file).read()
92+
assert 'diagnostics' in results.lower()
93+
assert __version__ in results
94+
95+
@pytest.mark.scanslow
96+
def test_html_output_includes_license_clarity_score():
97+
test_dir = test_env.get_test_loc('templated/simple')
98+
result_file = test_env.get_temp_file('html')
99+
run_scan_click(['--license', '--classify', '--license-clarity-score',
100+
test_dir, '--html', result_file])
101+
results = open(result_file).read()
102+
assert 'License Clarity Score' in results
103+
assert 'score' in results.lower()
104+
assert __version__ in results
105+
106+
@pytest.mark.scanslow
107+
def test_html_output_includes_summary():
108+
test_dir = test_env.get_test_loc('templated/simple')
109+
result_file = test_env.get_temp_file('html')
110+
run_scan_click(['--license', '--classify', '--summary',
111+
test_dir, '--html', result_file])
112+
results = open(result_file).read()
113+
assert 'Scan Summary' in results
114+
assert __version__ in results
75115

76116
@pytest.mark.scanslow
77117
def test_scanned_path_is_present_in_html_app_output():

0 commit comments

Comments
 (0)