@@ -472,5 +472,45 @@ def test_generate_attribution(self):
472472 result = about_collector .generate_attribution ('testdata/attrib/test.template' )
473473 self .assertEqual (result , expected )
474474
475+ def test_license_text_extracted_from_license_text_file (self ):
476+ expected = '''Tester holds the copyright for test component. Tester relinquishes copyright of
477+ this software and releases the component to Public Domain.
478+
479+ * Email [email protected] for any questions''' 480+
481+ about_file = about .AboutFile ('testdata/attrib/license_text.ABOUT' )
482+ license_text = about_file .license_text ()
483+ self .assertEqual (license_text , expected )
484+
485+ def test_notice_text_extacted_from_notice_text_file (self ):
486+ expected = '''Test component is released to Public Domain.'''
487+ about_file = about .AboutFile ('testdata/attrib/license_text.ABOUT' )
488+ notice_text = about_file .notice_text ()
489+ self .assertEqual (notice_text , expected )
490+
491+ def test_license_text_returns_empty_string_when_no_field_present (self ):
492+ expected = ''
493+ about_file = about .AboutFile ('testdata/attrib/no_text_file_field.ABOUT' )
494+ license_text = about_file .license_text ()
495+ self .assertEqual (license_text , expected )
496+
497+ def test_notice_text_returns_empty_string_when_no_field_present (self ):
498+ expected = ''
499+ about_file = about .AboutFile ('testdata/attrib/no_text_file_field.ABOUT' )
500+ notice_text = about_file .notice_text ()
501+ self .assertEqual (notice_text , expected )
502+
503+ def test_license_text_returns_empty_string_when_ref_file_doesnt_exist (self ):
504+ expected = ''
505+ about_file = about .AboutFile ('testdata/attrib/missing_notice_license_files.ABOUT' )
506+ license_text = about_file .license_text ()
507+ self .assertEqual (license_text , expected )
508+
509+ def test_notice_text_returns_empty_string_when_ref_file_doesnt_exist (self ):
510+ expected = ''
511+ about_file = about .AboutFile ('testdata/attrib/missing_notice_license_files.ABOUT' )
512+ notice_text = about_file .notice_text ()
513+ self .assertEqual (notice_text , expected )
514+
475515if __name__ == "__main__" :
476516 unittest .main ()
0 commit comments