@@ -240,6 +240,19 @@ def test_get_dje_license_list_gen_license_with_empty_dje_license_key_empty_licen
240240 self .assertTrue (len (gen .warnings ) == 1 , "Should return 1 warning." )
241241 self .assertFalse (gen .errors , "No errors should be returned." )
242242
243+ def test_get_dje_license_list_gen_license_with_dje_license_key_no_license_text_file (self ):
244+ gen = genabout .GenAbout ()
245+ gen_location = join (TESTDATA_PATH , "test_files_for_genabout/" )
246+ input_list = [{'about_file' : '/about.py.ABOUT' , 'version' : '0.8.1' ,
247+ 'about_resource' : '.' , 'name' : 'ABOUT tool' ,
248+ 'dje_license_key' : 'apache-2.0' }]
249+ expected_output_list = [('/' , 'apache-2.0' )]
250+ gen_license = True
251+ lic_output_list = gen .get_dje_license_list (gen_location , input_list , gen_license )
252+ self .assertTrue (expected_output_list == lic_output_list )
253+ self .assertFalse (gen .warnings , "No warnings should be returned." )
254+ self .assertFalse (gen .errors , "No errors should be returned." )
255+
243256 def test_pre_generation_about_is_dir_exists_action_0 (self ):
244257 gen = genabout .GenAbout ()
245258 gen_location = join (TESTDATA_PATH , "test_files_for_genabout/" )
@@ -352,7 +365,7 @@ def test_format_output_with_continuation(self):
352365
353366 def test_verify_license_files_exist (self ):
354367 gen = genabout .GenAbout ()
355- input_list = [{'version' : '0.8.1' , 'about_file' : 'about.py.ABOUT ' ,
368+ input_list = [{'version' : '0.8.1' , 'about_file' : '/TESTCASE/ ' ,
356369 'license_text_file' : 'apache2.LICENSE.txt' ,
357370 'name' : 'ABOUT tool' , 'about_resource' : '.' }]
358371 path = '.'
@@ -362,9 +375,33 @@ def test_verify_license_files_exist(self):
362375 self .assertFalse (gen .warnings , "No warnings should be returned." )
363376 self .assertFalse (gen .errors , "No errors should be returned." )
364377
378+ def test_verify_license_files_exist_license_in_project (self ):
379+ gen = genabout .GenAbout ()
380+ input_list = [{'version' : '0.8.1' , 'about_file' : '/TESTCASE/' ,
381+ 'license_text_file' : 'apache2.LICENSE.txt' ,
382+ 'name' : 'ABOUT tool' , 'about_resource' : '.' }]
383+ path = '.'
384+ expected_list = [('./apache2.LICENSE.txt' , '' )]
385+ output = gen .verify_license_files (input_list , path , True )
386+ self .assertEqual (expected_list , output )
387+ self .assertFalse (gen .warnings , "No warnings should be returned." )
388+ self .assertFalse (gen .errors , "No errors should be returned." )
389+
365390 def test_verify_license_files_not_exist (self ):
366391 gen = genabout .GenAbout ()
367- input_list = [{'version' : '0.8.1' , 'about_file' : 'about.py.ABOUT' ,
392+ input_list = [{'version' : '0.8.1' , 'about_file' : '/about.py.ABOUT' ,
393+ 'license_text_file' : 'not_exist.LICENSE.txt' ,
394+ 'name' : 'ABOUT tool' , 'about_resource' : '.' }]
395+ path = '.'
396+ expected_list = []
397+ output = gen .verify_license_files (input_list , path , False )
398+ self .assertTrue (expected_list == output )
399+ self .assertTrue (len (gen .warnings ) == 1 , "Should return 1 warning." )
400+ self .assertFalse (gen .errors , "No errors should be returned." )
401+
402+ def test_verify_license_files_not_exist_license_in_project (self ):
403+ gen = genabout .GenAbout ()
404+ input_list = [{'version' : '0.8.1' , 'about_file' : '/TESTCASE/' ,
368405 'license_text_file' : 'not_exist.LICENSE.txt' ,
369406 'name' : 'ABOUT tool' , 'about_resource' : '.' }]
370407 path = '.'
@@ -376,7 +413,7 @@ def test_verify_license_files_not_exist(self):
376413
377414 def test_verify_license_files_no_key (self ):
378415 gen = genabout .GenAbout ()
379- input_list = [{'version' : '0.8.1' , 'about_file' : 'about.py.ABOUT' ,
416+ input_list = [{'version' : '0.8.1' , 'about_file' : '/ about.py.ABOUT' ,
380417 'name' : 'ABOUT tool' , 'about_resource' : '.' }]
381418 path = '.'
382419 self .assertRaises (Exception , gen .verify_license_files , input_list , path )
0 commit comments