@@ -169,7 +169,8 @@ def test_get_dje_license_list_no_gen_license_with_no_license_text_file_key(self)
169169 'about_resource' : '.' , 'name' : 'ABOUT tool' }]
170170 expected_output_list = []
171171 gen_license = False
172- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
172+ dje_license_dict = {}
173+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
173174 self .assertTrue (expected_output_list == lic_output_list )
174175 self .assertFalse (gen .warnings , "No warnings should be returned." )
175176 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -182,7 +183,8 @@ def test_get_dje_license_list_no_gen_license_with_license_text_file_key_not_exis
182183 'license_text_file' : 'not_exist.txt' }]
183184 expected_output_list = []
184185 gen_license = False
185- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
186+ dje_license_dict = {}
187+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
186188 self .assertTrue (expected_output_list == lic_output_list )
187189 self .assertFalse (gen .warnings , "No warnings should be returned." )
188190 self .assertTrue (len (gen .errors ) == 1 , "Should return 1 error." )
@@ -195,7 +197,8 @@ def test_get_dje_license_list_file_no_gen_license_with_license_text_file_key_exi
195197 'license_text_file' : '../../../../apache2.LICENSE' }]
196198 expected_output_list = []
197199 gen_license = False
198- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
200+ dje_license_dict = {}
201+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
199202 self .assertTrue (expected_output_list == lic_output_list )
200203 self .assertFalse (gen .warnings , "No warnings should be returned." )
201204 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -208,7 +211,8 @@ def test_get_dje_license_list_dir_no_gen_license_with_license_text_file_key_exis
208211 'license_text_file' : '../../../../apache2.LICENSE' }]
209212 expected_output_list = []
210213 gen_license = False
211- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
214+ dje_license_dict = {}
215+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
212216 self .assertTrue (expected_output_list == lic_output_list )
213217 self .assertFalse (gen .warnings , "No warnings should be returned." )
214218 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -218,10 +222,12 @@ def test_get_dje_license_list_file_gen_license_with_license_text_file_key_exist(
218222 gen_location = join (TESTDATA_PATH , "test_files_for_genabout/" )
219223 input_list = [{'about_file' : '/about.py.ABOUT' , 'version' : '0.8.1' ,
220224 'about_resource' : '.' , 'name' : 'ABOUT tool' ,
225+ 'dje_license' : 'Apache License 2.0' ,
221226 'license_text_file' : '../../../../apache2.LICENSE' }]
222227 expected_output_list = []
223228 gen_license = True
224- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
229+ dje_license_dict = {'Apache License 2.0' : [u'apache-2.0' , 'test context' ]}
230+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
225231 self .assertTrue (expected_output_list == lic_output_list )
226232 self .assertFalse (gen .warnings , "No warnings should be returned." )
227233 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -231,11 +237,13 @@ def test_get_dje_license_list_gen_license_with_dje_license_key_empty_license_tex
231237 gen_location = join (TESTDATA_PATH , "test_files_for_genabout/" )
232238 input_list = [{'about_file' : '/about.py.ABOUT' , 'version' : '0.8.1' ,
233239 'about_resource' : '.' , 'name' : 'ABOUT tool' ,
240+ 'dje_license' : 'apache-2.0' ,
234241 'dje_license_name' : 'Apache License 2.0' ,
235- 'license_text_file' : '' , 'dje_license' : 'apache-2.0' }]
242+ 'license_text_file' : '' }]
236243 expected_output_list = [('/' , 'Apache License 2.0' )]
237244 gen_license = True
238- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
245+ dje_license_dict = {'Apache License 2.0' : [u'apache-2.0' , 'test context' ]}
246+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
239247 self .assertTrue (expected_output_list == lic_output_list )
240248 self .assertFalse (gen .warnings , "No warnings should be returned." )
241249 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -248,7 +256,8 @@ def test_get_dje_license_list_gen_license_with_empty_dje_license_key_empty_licen
248256 'license_text_file' : '' , 'dje_license' : '' }]
249257 expected_output_list = []
250258 gen_license = True
251- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
259+ dje_license_dict = {'Apache License 2.0' : [u'apache-2.0' , 'test context' ]}
260+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
252261 self .assertTrue (expected_output_list == lic_output_list )
253262 self .assertTrue (len (gen .warnings ) == 1 , "Should return 1 warning." )
254263 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -259,10 +268,11 @@ def test_get_dje_license_list_gen_license_with_dje_license_key_no_license_text_f
259268 input_list = [{'about_file' : '/about.py.ABOUT' , 'version' : '0.8.1' ,
260269 'about_resource' : '.' , 'name' : 'ABOUT tool' ,
261270 'dje_license_name' : 'Apache License 2.0' ,
262- 'dje_license' : 'apache- 2.0' }]
271+ 'dje_license' : 'Apache License 2.0' }]
263272 expected_output_list = [('/' , 'Apache License 2.0' )]
264273 gen_license = True
265- lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
274+ dje_license_dict = {'Apache License 2.0' : [u'apache-2.0' , 'test context' ]}
275+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license , dje_license_dict )
266276 self .assertTrue (expected_output_list == lic_output_list )
267277 self .assertFalse (gen .warnings , "No warnings should be returned." )
268278 self .assertFalse (gen .errors , "No errors should be returned." )
@@ -441,7 +451,6 @@ def test_gen_license_list_license_text_file_no_value(self):
441451 expected_list = ('/tmp/3pp' , 'Apache License 2.0' )
442452 output = gen .gen_license_list (input_list )
443453 self .assertTrue (expected_list == output )
444- self .assertTrue (input_list ['license_text_file' ] == 'Apache License 2.0.LICENSE' )
445454
446455 def test_gen_license_list_no_license_text_file_key (self ):
447456 gen = genabout .GenAbout ()
@@ -452,7 +461,6 @@ def test_gen_license_list_no_license_text_file_key(self):
452461 expected_list = ('/tmp/3pp' , 'Apache License 2.0' )
453462 output = gen .gen_license_list (input_list )
454463 self .assertTrue (expected_list == output )
455- self .assertTrue (input_list ['license_text_file' ] == 'Apache License 2.0.LICENSE' )
456464
457465 def test_copy_license_files_test_path_not_endswith_slash (self ):
458466 gen = genabout .GenAbout ()
@@ -494,8 +502,8 @@ def test_write_licenses(self):
494502 def test_process_dje_licenses (self ):
495503 gen = genabout .GenAbout ()
496504 test_license_list = [('/' , 'test' )]
497- test_license_dict = {'test' : u' This is a test license.' }
505+ test_license_dict = {'test' : [ u'test_key' , u' This is a test license.'] }
498506 test_path = '/test'
499- expected_output = [['/test/test .LICENSE' , 'This is a test license.' ]]
507+ expected_output = [['/test/test_key .LICENSE' , 'This is a test license.' ]]
500508 output = gen .process_dje_licenses (test_license_list , test_license_dict , test_path )
501509 self .assertTrue (output == expected_output )
0 commit comments