@@ -103,12 +103,12 @@ def test_load_inventory_with_errors(self):
103103 base_dir = get_temp_dir ()
104104 errors , abouts = gen .load_inventory (location , base_dir = base_dir )
105105 expected_errors = [
106- Error (CRITICAL , "Field name: 'confirmed copyright' contains illegal name characters: 0 to 9, a to z, A to Z and _." ),
107106 Error (INFO , 'Field resource is a custom field.' ),
108107 Error (INFO , 'Field test is a custom field.' ),
108+ Error (CRITICAL , "Field name: ['confirmed copyright'] contains illegal name characters: 0 to 9, a to z, A to Z and _. (or empty spaces) and is ignored." ),
109109 Error (INFO , 'Field about_resource: Path' )
110110 ]
111- # assert [] == errors
111+
112112 for exp , err in zip (expected_errors , errors ):
113113 assert exp .severity == err .severity
114114 assert err .message .startswith (exp .message )
@@ -179,7 +179,6 @@ def test_generation_with_no_about_resource(self):
179179 location = get_test_loc ('test_gen/inv2.csv' )
180180 base_dir = get_temp_dir ()
181181 errors , abouts = gen .generate (location , base_dir )
182-
183182 expected = dict ([('.' , None )])
184183 assert abouts [0 ].about_resource .value == expected
185184 assert len (errors ) == 1
@@ -285,79 +284,47 @@ def test_generate_license_key_with_custom_file_450_no_fetch(self):
285284 expected = (
286285'''about_resource: test.c
287286name: test.c
288- license_expression: public-domain AND custom
287+ license_expression: mit AND custom
289288licenses:
290289 - file: custom.txt
291290'''
292291 )
293292 assert expected == result
294293
295- def test_generate_license_key_with_custom_file_450_with_fetch (self ):
296- location = get_test_loc ('test_gen/lic_issue_450/custom_and_valid_lic_key_with_file.csv' )
297- base_dir = get_temp_dir ()
298-
299- errors , abouts = gen .generate (location , base_dir )
300-
301- lic_dict = {u'public-domain' : [u'Public Domain' ,
302- u'public-domain.LICENSE' ,
303- u'This component is released to the public domain by the author.' ,
304- u'https://enterprise.dejacode.com/urn/?urn=urn:dje:license:public-domain' ,
305- u''
306- ]}
307- a = abouts [0 ]
308- a .license_key .value .append ('public-domain' )
309- a .license_key .value .append ('custom' )
310- result = a .dumps (lic_dict )
311- expected = (
312- '''about_resource: test.c
313- name: test.c
314- license_expression: public-domain AND custom
315- licenses:
316- - key: public-domain
317- name: Public Domain
318- file: public-domain.LICENSE
319- url: https://enterprise.dejacode.com/urn/?urn=urn:dje:license:public-domain
320- spdx_license_key:
321- - key: custom
322- name: custom
323- file: custom.txt
324- '''
325- )
326- assert expected == result
327294
328295 def test_generate_license_key_with_custom_file_450_with_fetch_with_order (self ):
329296 location = get_test_loc ('test_gen/lic_issue_450/custom_and_valid_lic_key_with_file.csv' )
330297 base_dir = get_temp_dir ()
331298
332299 errors , abouts = gen .generate (location , base_dir )
333300
334- lic_dict = {u'public-domain ' : [u'Public Domain ' ,
335- u'public-domain .LICENSE' ,
336- u'This component is released to the public domain by the author .' ,
337- u'https://enterprise.dejacode.com/urn/?urn=urn:dje:license:public-domain ' ,
338- u''
301+ lic_dict = {u'mit ' : [u'MIT License ' ,
302+ u'mit .LICENSE' ,
303+ u'This component is released under MIT License .' ,
304+ u'https://enterprise.dejacode.com/urn/?urn=urn:dje:license:mit ' ,
305+ u'mit '
339306 ]}
340307 # The first row from the test file
341308 a = abouts [0 ]
342- a .license_key .value .append ('public-domain ' )
309+ a .license_key .value .append ('mit ' )
343310 a .license_key .value .append ('custom' )
344311 result1 = a .dumps (lic_dict )
345312 # The second row from the test file
346313 b = abouts [1 ]
347314 b .license_key .value .append ('custom' )
348- b .license_key .value .append ('public-domain ' )
315+ b .license_key .value .append ('mit ' )
349316 result2 = b .dumps (lic_dict )
350317
351318 expected1 = (
352319'''about_resource: test.c
353320name: test.c
354- license_expression: public-domain AND custom
321+ license_expression: mit AND custom
355322licenses:
356- - key: public-domain
357- name: Public Domain
358- file: public-domain .LICENSE
359- url: https://enterprise.dejacode.com/urn/?urn=urn:dje:license:public-domain
360- spdx_license_key:
323+ - key: mit
324+ name: MIT License
325+ file: mit .LICENSE
326+ url: https://enterprise.dejacode.com/urn/?urn=urn:dje:license:mit
327+ spdx_license_key: mit
361328 - key: custom
362329 name: custom
363330 file: custom.txt
@@ -367,16 +334,16 @@ def test_generate_license_key_with_custom_file_450_with_fetch_with_order(self):
367334 expected2 = (
368335'''about_resource: test.h
369336name: test.h
370- license_expression: custom AND public-domain
337+ license_expression: custom AND mit
371338licenses:
372339 - key: custom
373340 name: custom
374341 file: custom.txt
375- - key: public-domain
376- name: Public Domain
377- file: public-domain .LICENSE
378- url: https://enterprise.dejacode.com/urn/?urn=urn:dje:license:public-domain
379- spdx_license_key:
342+ - key: mit
343+ name: MIT License
344+ file: mit .LICENSE
345+ url: https://enterprise.dejacode.com/urn/?urn=urn:dje:license:mit
346+ spdx_license_key: mit
380347'''
381348 )
382349 assert expected1 == result1
0 commit comments