def test_apply_to_dir_auth_groups_field(self): dir_path = THIS_DIRECTORY + \ '/testserver_root/build-info/subdir2' build_info = BuildInfo(dir_path) expected = [{ 'build-name': 'landing-protected', 'license-type': 'protected', 'auth-groups': 'linaro' }] self.assertEquals(expected, build_info.getInfoForFile())
def test_buildinfo_simple_filename(self): with temporary_directory() as serve_root: sample_file = serve_root.make_file("MD5SUM", data="blah") serve_root.make_file("BUILD-INFO.txt", data=("Format-Version: 2.0\n\n" "Files-Pattern: MD5SUM\n" "License-Type: open\n")) build_info = BuildInfo(sample_file) file_info = build_info.getInfoForFile() self.assertEqual('open', file_info[0]['license-type'])
def test_getInfoForFile_no_block_for_file(self): file_path = os.path.abspath(__file__) build_info = BuildInfo(self.buildinfo_file_path) build_info.full_file_name = file_path build_info.build_info_array = [{}] build_info.file_info_array = [{}] data = [ "Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected" ] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() self.assertEquals(build_info.file_info_array, [{}])
def test_remove_false_positives_real(self): build_info = BuildInfo(self.buildinfo_file_path) build_info.build_info_array = [{}] build_info.file_info_array = [{}] data = [ "Format-Version: 2.0", "Files-Pattern: *.txt", "License-Type: protected", "Files-Pattern: *.txt", "License-Type: open" ] build_info.parseData(data) build_info.file_info_array = build_info.getInfoForFile() build_info.remove_false_positives() self.assertEquals(build_info.file_info_array, [{ 'license-type': 'protected' }])