Skip to content

Commit

Permalink
Fix and update test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
chinyeungli committed Aug 15, 2014
1 parent ed01532 commit 41dd664
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions about_code_tool/tests/test_genabout.py
Expand Up @@ -63,8 +63,9 @@ def test_get_mapping_list(self):
gen = genabout.GenAbout()
expected_list = {'about_file': 'directory/filename',
'version': 'confirmed version',
'name': 'component',
'copyright': 'confirmed copyright'}
'name': 'component',
'copyright': 'confirmed copyright',
'confirmed_license': 'confirmed license'}
output = gen.get_mapping_list()
self.assertEquals(output, expected_list)

Expand Down Expand Up @@ -156,15 +157,26 @@ def test_validate_mandatory_fields_missing_about_resource(self):
# This is now True as it doesn't need about_resource
self.assertTrue(gen.validate_mandatory_fields(input_list))

def test_get_non_supported_fields(self):
def test_get_non_supported_fields_no_mapping(self):
gen = genabout.GenAbout()
input = [{'about_file': '', 'name': 'OpenSans Fonts',
'non_supported field': 'TEST', 'version': '1',
'about_resource': 'opensans'}]
non_supported_list = gen.get_non_supported_fields(input)
mapping_keys = []
non_supported_list = gen.get_non_supported_fields(input, mapping_keys)
expected_list = ['non_supported field']
self.assertEquals(non_supported_list, expected_list)

def test_get_non_supported_fields_with_mapping(self):
gen = genabout.GenAbout()
input = [{'about_file': '', 'name': 'OpenSans Fonts',
'non_supported field': 'TEST', 'version': '1',
'about_resource': 'opensans'}]
mapping_keys = ['non_supported field']
non_supported_list = gen.get_non_supported_fields(input, mapping_keys)
expected_list = []
self.assertEquals(non_supported_list, expected_list)

def test_get_only_supported_fields(self):
gen = genabout.GenAbout()
input_list = [{'about_file': '/about.ABOUT', 'about_resource': '.',
Expand Down

0 comments on commit 41dd664

Please sign in to comment.