From 0f15e7368c6ea83a0f9152e97ad732fb3bb4e69d Mon Sep 17 00:00:00 2001 From: Georgy Redkozubov Date: Thu, 28 Jun 2012 15:41:28 +0400 Subject: Added handling of false-positives for files with both open and protected License-Type. --- .../tests/test_buildinfo.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'license_protected_downloads/tests/test_buildinfo.py') diff --git a/license_protected_downloads/tests/test_buildinfo.py b/license_protected_downloads/tests/test_buildinfo.py index 6bccade..ba4aa2a 100644 --- a/license_protected_downloads/tests/test_buildinfo.py +++ b/license_protected_downloads/tests/test_buildinfo.py @@ -178,6 +178,32 @@ class BuildInfoTests(unittest.TestCase): for field in build_info.fields_defined: self.assertTrue(build_info.isValidField(field)) + 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'}]) + + def test_remove_false_none(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: protected"] + 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'}, {'license-type': 'protected'}]) + if __name__ == '__main__': unittest.main() -- cgit v1.2.3