def testFindDuplicatesContainsFail(self): self.contains_mock.side_effect = Exception sym1 = self.createSymbolFile('sym1.sym') sym2 = self.createSymbolFile('sym2.sym') result = upload_symbols.FindDuplicates((sym1, sym2), 'namespace') self.assertEqual(list(result), [sym1, sym2]) self.assertEqual(sym1.status, upload_symbols.SymbolFile.INITIAL) self.assertIsNone(sym1.dedupe_item) self.assertIsNone(sym1.dedupe_push_state) self.assertEqual(sym2.status, upload_symbols.SymbolFile.INITIAL) self.assertIsNone(sym2.dedupe_item) self.assertIsNone(sym2.dedupe_push_state)
def testFindDuplicates(self): # The first symbol will new new, the second a duplicate. def containsOneNew(items): return {items[0]: 'state'} self.contains_mock.side_effect = containsOneNew sym1 = self.createSymbolFile('sym1.sym') sym2 = self.createSymbolFile('sym2.sym') result = upload_symbols.FindDuplicates((sym1, sym2), 'namespace') self.assertEqual(list(result), [sym1, sym2]) self.assertEqual(sym1.status, upload_symbols.SymbolFile.INITIAL) self.assertIsInstance(sym1.dedupe_item, upload_symbols.DedupeItem) self.assertEqual(sym1.dedupe_push_state, 'state') self.assertEqual(sym2.status, upload_symbols.SymbolFile.DUPLICATE) self.assertIsNone(sym2.dedupe_item) self.assertIsNone(sym2.dedupe_push_state)
def testFindDuplicates(self): # The first two symbols will be duplicate, the third new. sym1 = self.createSymbolFile('sym1.sym') sym1.header = cros_generate_breakpad_symbols.SymbolHeader( 'cpu', 'BEAA9BE', 'sym1_sym', 'os') sym2 = self.createSymbolFile('sym2.sym') sym2.header = cros_generate_breakpad_symbols.SymbolHeader( 'cpu', 'B6B1A36', 'sym2_sym', 'os') sym3 = self.createSymbolFile('sym3.sym') sym3.header = cros_generate_breakpad_symbols.SymbolHeader( 'cpu', 'D4FC0FC', 'sym3_sym', 'os') result = upload_symbols.FindDuplicates((sym1, sym2, sym3), 'fake_url', api_key='testkey') self.assertEqual(list(result), [sym1, sym2, sym3]) self.assertEqual(sym1.status, upload_symbols.SymbolFile.DUPLICATE) self.assertEqual(sym2.status, upload_symbols.SymbolFile.DUPLICATE) self.assertEqual(sym3.status, upload_symbols.SymbolFile.INITIAL)