Skip to content

Commit d609786

Browse files
Modify tests and test expectations
Modifies tests and test expectations for the change of file level attribute `packages` to `package_manifests`. Signed-off-by: Ayan Sinha <ayansmahapatra@gmail.com>
1 parent fbb33bd commit d609786

75 files changed

Lines changed: 533 additions & 615 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/formattedcode/output_csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def collect_keys(mapping, key_group):
194194
collect_keys(url_info, 'url')
195195
yield url_info
196196

197-
for package in scanned_file.get('packages', []):
197+
for package in scanned_file.get('package_manifests', []):
198198
flat = flatten_package(package, path)
199199
collect_keys(flat, 'package')
200200
yield flat

src/formattedcode/output_html.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def generate_output(results, version, template):
154154

155155
LICENSES = 'licenses'
156156
COPYRIGHTS = 'copyrights'
157-
PACKAGES = 'packages'
157+
PACKAGES = 'package_manifests'
158158

159159
# Create a flattened data dict keyed by path
160160
for scanned_file in results:
@@ -207,7 +207,7 @@ def generate_output(results, version, template):
207207
files = {
208208
'license_copyright': converted,
209209
'infos': converted_infos,
210-
'packages': converted_packages
210+
'package_manifests': converted_packages
211211
}
212212

213213
return template.generate(files=files, licenses=licenses, version=version)

src/formattedcode/templates/html/template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@
233233
</table>
234234
{% endif %}
235235

236-
{% if files.packages %}
236+
{% if files.package_manifests %}
237237
<table>
238238
<caption>Package Information</caption>
239239
<thead>
@@ -245,7 +245,7 @@
245245
</tr>
246246
</thead>
247247
<tbody>
248-
{% for path, data in files.packages.items() %}
248+
{% for path, data in files.package_manifests.items() %}
249249
{% for row in data %}
250250
<tr>
251251
<td>{{ path }}</td>

tests/formattedcode/data/csv/livescan/expected.csv

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
Resource,type,name,base_name,extension,size,date,sha1,md5,sha256,mime_type,file_type,programming_language,is_binary,is_text,is_archive,is_media,is_source,is_script,percentage_of_license_text,files_count,dirs_count,size_count,scan_errors,license_expression,license__key,license__score,license__name,license__short_name,license__category,license__is_exception,license__is_unknown,license__owner,license__homepage_url,license__text_url,license__reference_url,license__scancode_text_url,license__scancode_data_url,license__spdx_license_key,license__spdx_url,start_line,end_line,matched_rule__identifier,matched_rule__license_expression,matched_rule__licenses,matched_rule__referenced_filenames,matched_rule__is_license_text,matched_rule__is_license_notice,matched_rule__is_license_reference,matched_rule__is_license_tag,matched_rule__is_license_intro,matched_rule__has_unknown,matched_rule__matcher,matched_rule__rule_length,matched_rule__matched_length,matched_rule__match_coverage,matched_rule__rule_relevance,copyright,copyright_holder,email,url,package__type,package__namespace,package__name,package__version,package__qualifiers,package__subpath,package__primary_language,package__description,package__release_date,package__homepage_url,package__download_url,package__size,package__sha1,package__md5,package__sha256,package__sha512,package__bug_tracking_url,package__code_view_url,package__vcs_url,package__copyright,package__license_expression,package__declared_license,package__notice_text,package__root_path,package__contains_source_code,package__extra_data,package__purl
2-
json2csv.rb,file,json2csv.rb,json2csv,.rb,912,2020-04-27,1236469a06a2bacbdd8e172ad718482af5b0a936,1307c281e0b153202e291b217eab85d5,12ba215313981dbe810d9ed696b7cc753d97adfcc26eba1e13f941dc7506aa4e,text/x-script.python,"Python script, ASCII text executable",Ruby,False,True,False,False,True,True,62.04,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2+
json2csv.rb,file,json2csv.rb,json2csv,.rb,912,2021-09-09,1236469a06a2bacbdd8e172ad718482af5b0a936,1307c281e0b153202e291b217eab85d5,12ba215313981dbe810d9ed696b7cc753d97adfcc26eba1e13f941dc7506aa4e,text/x-script.python,"Python script, ASCII text executable",Ruby,False,True,False,False,True,True,62.04,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
33
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,apache-2.0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
44
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,apache-2.0,100.00,Apache License 2.0,Apache 2.0,Permissive,False,False,Apache Software Foundation,http://www.apache.org/licenses/,http://www.apache.org/licenses/LICENSE-2.0,https://scancode-licensedb.aboutcode.org/apache-2.0,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-2.0.LICENSE,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/apache-2.0.yml,Apache-2.0,https://spdx.org/licenses/Apache-2.0,5,13,apache-2.0_7.RULE,apache-2.0,apache-2.0,,,True,,,,,2-aho,85,85,100.00,100.00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
55
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,3,,,,,,,,,,,,,,,,Copyright (c) 2017 nexB Inc. and others,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
66
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,3,3,,,,,,,,,,,,,,,,,nexB Inc. and others,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
77
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,4,,,,,,,,,,,,,,,,,,,http://nexb.com/,,,,,,,,,,,,,,,,,,,,,,,,,,,
88
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,4,4,,,,,,,,,,,,,,,,,,,https://github.com/nexB/scancode-toolkit/,,,,,,,,,,,,,,,,,,,,,,,,,,,
99
json2csv.rb,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,8,8,,,,,,,,,,,,,,,,,,,http://www.apache.org/licenses/LICENSE-2.0,,,,,,,,,,,,,,,,,,,,,,,,,,,
10-
license,file,license,license,,679,2019-11-03,75c5490a718ddd45e40e0cc7ce0c756abc373123,b965a762efb9421cf1bf4405f336e278,a34098a43e5677495f59dff825a3f9bc0f2b0261d75feb2356919f4c3ce049ab,text/plain,ASCII text,,False,True,False,False,False,False,100.0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
10+
license,file,license,license,,679,2021-09-09,75c5490a718ddd45e40e0cc7ce0c756abc373123,b965a762efb9421cf1bf4405f336e278,a34098a43e5677495f59dff825a3f9bc0f2b0261d75feb2356919f4c3ce049ab,text/plain,ASCII text,,False,True,False,False,False,False,100.0,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1111
license,,,,,,,,,,,,,,,,,,,,,,,,gpl-2.0-plus,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1212
license,,,,,,,,,,,,,,,,,,,,,,,,,gpl-2.0-plus,100.00,GNU General Public License 2.0 or later,GPL 2.0 or later,Copyleft,False,False,Free Software Foundation (FSF),http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html,http://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html,https://scancode-licensedb.aboutcode.org/gpl-2.0-plus,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.LICENSE,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/gpl-2.0-plus.yml,GPL-2.0-or-later,https://spdx.org/licenses/GPL-2.0-or-later,1,12,gpl-2.0-plus_420.RULE,gpl-2.0-plus,gpl-2.0-plus,,,True,,,,,1-hash,113,113,100.00,100.00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
13-
package.json,file,package.json,package,.json,2200,2019-11-03,918376afce796ef90eeda1d6695f2289c90491ac,1f66239a9b850c5e60a9382dbe2162d2,29f6068a1b6c7d06f115a5edc4ed8558edde42c6bbf0145ed77cf1108a0dd529,application/json,JSON data,,False,True,False,False,False,False,58.1,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
13+
package.json,file,package.json,package,.json,2200,2021-09-09,918376afce796ef90eeda1d6695f2289c90491ac,1f66239a9b850c5e60a9382dbe2162d2,29f6068a1b6c7d06f115a5edc4ed8558edde42c6bbf0145ed77cf1108a0dd529,application/json,JSON data,,False,True,False,False,False,False,58.1,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1414
package.json,,,,,,,,,,,,,,,,,,,,,,,,mit,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1515
package.json,,,,,,,,,,,,,,,,,,,,,,,,mit,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
1616
package.json,,,,,,,,,,,,,,,,,,,,,,,,,mit,100.00,MIT License,MIT License,Permissive,False,False,MIT,http://opensource.org/licenses/mit-license.php,http://opensource.org/licenses/mit-license.php,https://scancode-licensedb.aboutcode.org/mit,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.LICENSE,https://github.com/nexB/scancode-toolkit/tree/develop/src/licensedcode/data/licenses/mit.yml,MIT,https://spdx.org/licenses/MIT,24,24,mit_649.RULE,mit,mit,,,True,,,,,2-aho,4,4,100.00,100.00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

tests/formattedcode/data/json/simple-expected.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"copyrights": [],
4646
"holders": [],
4747
"authors": [],
48-
"packages": [],
48+
"package_manifests": [],
4949
"files_count": 1,
5050
"dirs_count": 0,
5151
"size_count": 55,
@@ -88,7 +88,7 @@
8888
}
8989
],
9090
"authors": [],
91-
"packages": [],
91+
"package_manifests": [],
9292
"files_count": 0,
9393
"dirs_count": 0,
9494
"size_count": 0,

tests/formattedcode/data/json/simple-expected.jsonpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"copyrights": [],
4646
"holders": [],
4747
"authors": [],
48-
"packages": [],
48+
"package_manifests": [],
4949
"files_count": 1,
5050
"dirs_count": 0,
5151
"size_count": 55,
@@ -88,7 +88,7 @@
8888
}
8989
],
9090
"authors": [],
91-
"packages": [],
91+
"package_manifests": [],
9292
"files_count": 0,
9393
"dirs_count": 0,
9494
"size_count": 0,

tests/formattedcode/data/json/tree/expected.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
}
5959
],
6060
"authors": [],
61-
"packages": [],
61+
"package_manifests": [],
6262
"files_count": 0,
6363
"dirs_count": 0,
6464
"size_count": 0,
@@ -101,7 +101,7 @@
101101
}
102102
],
103103
"authors": [],
104-
"packages": [],
104+
"package_manifests": [],
105105
"files_count": 0,
106106
"dirs_count": 0,
107107
"size_count": 0,
@@ -144,7 +144,7 @@
144144
}
145145
],
146146
"authors": [],
147-
"packages": [],
147+
"package_manifests": [],
148148
"files_count": 0,
149149
"dirs_count": 0,
150150
"size_count": 0,
@@ -175,7 +175,7 @@
175175
"copyrights": [],
176176
"holders": [],
177177
"authors": [],
178-
"packages": [],
178+
"package_manifests": [],
179179
"files_count": 4,
180180
"dirs_count": 0,
181181
"size_count": 361,
@@ -218,7 +218,7 @@
218218
}
219219
],
220220
"authors": [],
221-
"packages": [],
221+
"package_manifests": [],
222222
"files_count": 0,
223223
"dirs_count": 0,
224224
"size_count": 0,
@@ -261,7 +261,7 @@
261261
}
262262
],
263263
"authors": [],
264-
"packages": [],
264+
"package_manifests": [],
265265
"files_count": 0,
266266
"dirs_count": 0,
267267
"size_count": 0,
@@ -304,7 +304,7 @@
304304
}
305305
],
306306
"authors": [],
307-
"packages": [],
307+
"package_manifests": [],
308308
"files_count": 0,
309309
"dirs_count": 0,
310310
"size_count": 0,
@@ -347,7 +347,7 @@
347347
}
348348
],
349349
"authors": [],
350-
"packages": [],
350+
"package_manifests": [],
351351
"files_count": 0,
352352
"dirs_count": 0,
353353
"size_count": 0,

tests/formattedcode/data/templated/sample-template.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
</table>
246246
{% endif %}
247247

248-
{% if files.packages %}
248+
{% if files.package_manifests %}
249249
<table>
250250
<caption>Package Information</caption>
251251
<thead>
@@ -257,7 +257,7 @@
257257
</tr>
258258
</thead>
259259
<tbody>
260-
{% for path, data in files.packages.items() %}
260+
{% for path, data in files.package_manifests.items() %}
261261
{% for row in data %}
262262
<tr>
263263
<td>{{ path }}</td>

tests/formattedcode/data/yaml/simple-expected.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ files:
4343
copyrights: []
4444
holders: []
4545
authors: []
46-
packages: []
46+
package_manifests: []
4747
files_count: 1
4848
dirs_count: '0'
4949
size_count: 55
@@ -78,7 +78,7 @@ files:
7878
start_line: 1
7979
end_line: 1
8080
authors: []
81-
packages: []
81+
package_manifests: []
8282
files_count: '0'
8383
dirs_count: '0'
8484
size_count: '0'

tests/formattedcode/data/yaml/tree/expected.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ files:
5050
start_line: 1
5151
end_line: 1
5252
authors: []
53-
packages: []
53+
package_manifests: []
5454
files_count: '0'
5555
dirs_count: '0'
5656
size_count: '0'
@@ -85,7 +85,7 @@ files:
8585
start_line: 1
8686
end_line: 1
8787
authors: []
88-
packages: []
88+
package_manifests: []
8989
files_count: '0'
9090
dirs_count: '0'
9191
size_count: '0'
@@ -120,7 +120,7 @@ files:
120120
start_line: 1
121121
end_line: 1
122122
authors: []
123-
packages: []
123+
package_manifests: []
124124
files_count: '0'
125125
dirs_count: '0'
126126
size_count: '0'
@@ -149,7 +149,7 @@ files:
149149
copyrights: []
150150
holders: []
151151
authors: []
152-
packages: []
152+
package_manifests: []
153153
files_count: 4
154154
dirs_count: '0'
155155
size_count: 361
@@ -184,7 +184,7 @@ files:
184184
start_line: 1
185185
end_line: 1
186186
authors: []
187-
packages: []
187+
package_manifests: []
188188
files_count: '0'
189189
dirs_count: '0'
190190
size_count: '0'
@@ -219,7 +219,7 @@ files:
219219
start_line: 1
220220
end_line: 1
221221
authors: []
222-
packages: []
222+
package_manifests: []
223223
files_count: '0'
224224
dirs_count: '0'
225225
size_count: '0'
@@ -254,7 +254,7 @@ files:
254254
start_line: 1
255255
end_line: 1
256256
authors: []
257-
packages: []
257+
package_manifests: []
258258
files_count: '0'
259259
dirs_count: '0'
260260
size_count: '0'
@@ -289,7 +289,7 @@ files:
289289
start_line: 1
290290
end_line: 1
291291
authors: []
292-
packages: []
292+
package_manifests: []
293293
files_count: '0'
294294
dirs_count: '0'
295295
size_count: '0'

0 commit comments

Comments
 (0)