def test_process_apex_keys_apk_certs_HandlesApkCertsSyntax(self): output_dir = common.MakeTempDir() os.makedirs(os.path.join(output_dir, 'META')) framework_dir = common.MakeTempDir() os.makedirs(os.path.join(framework_dir, 'META')) os.symlink(os.path.join(self.testdata_dir, 'apkcerts_framework.txt'), os.path.join(framework_dir, 'META', 'apkcerts.txt')) vendor_dir = common.MakeTempDir() os.makedirs(os.path.join(vendor_dir, 'META')) os.symlink(os.path.join(self.testdata_dir, 'apkcerts_vendor.txt'), os.path.join(vendor_dir, 'META', 'apkcerts.txt')) process_apex_keys_apk_certs_common( framework_dir, vendor_dir, output_dir, set(['product', 'system', 'system_ext']), set(['odm', 'vendor']), 'apkcerts.txt') merged_entries = [] merged_path = os.path.join(self.testdata_dir, 'apkcerts_merge.txt') with open(merged_path) as f: merged_entries = f.read().split('\n') output_entries = [] output_path = os.path.join(output_dir, 'META', 'apkcerts.txt') with open(output_path) as f: output_entries = f.read().split('\n') return self.assertEqual(merged_entries, output_entries)
def test_process_apex_keys_apk_certs_ReturnsTrueIfNoConflicts(self): output_dir = common.MakeTempDir() os.makedirs(os.path.join(output_dir, 'META')) system_dir = common.MakeTempDir() os.makedirs(os.path.join(system_dir, 'META')) os.symlink(os.path.join(self.testdata_dir, 'apexkeys_system.txt'), os.path.join(system_dir, 'META', 'apexkeys.txt')) other_dir = common.MakeTempDir() os.makedirs(os.path.join(other_dir, 'META')) os.symlink(os.path.join(self.testdata_dir, 'apexkeys_other.txt'), os.path.join(other_dir, 'META', 'apexkeys.txt')) process_apex_keys_apk_certs_common(system_dir, other_dir, output_dir, 'apexkeys.txt') merged_entries = [] merged_path = os.path.join(self.testdata_dir, 'apexkeys_merge.txt') with open(merged_path) as f: merged_entries = f.read().split('\n') output_entries = [] output_path = os.path.join(output_dir, 'META', 'apexkeys.txt') with open(output_path) as f: output_entries = f.read().split('\n') return self.assertEqual(merged_entries, output_entries)