def test_process_crate_doesnt_call_update_def_on_duplicate_crates(self): crate1 = Crate('DNROilGasWells', check_for_changes_gdb, check_for_changes_gdb, 'a') crate2 = Crate('DNROilGasWells', check_for_changes_gdb, check_for_changes_gdb, 'a') pallet = Pallet() pallet._crates = [crate1, crate2] update_def = Mock(return_value=(Crate.UPDATED, 'message')) lift.process_crates_for([pallet], update_def) self.assertEqual(update_def.call_count, 1) self.assertEqual(crate1.result[0], Crate.UPDATED) self.assertEqual(crate2.result[0], Crate.UPDATED)
def test_process_crate_doesnt_call_update_def_on_duplicate_crates(self): crate1 = Crate('DNROilGasWells', test_gdb, test_gdb, 'a') crate2 = Crate('DNROilGasWells', test_gdb, test_gdb, 'a') pallet = Pallet() pallet._crates = [crate1, crate2] update_def = Mock(return_value=(Crate.UPDATED, 'message')) lift.process_crates_for([pallet], update_def) self.assertEqual(update_def.call_count, 1) self.assertEqual(crate1.result[0], Crate.UPDATED) self.assertEqual(crate2.result[0], Crate.UPDATED)
def test_process_crate_for_set_results(self): crate1 = Crate('DNROilGasWells', check_for_changes_gdb, check_for_changes_gdb, 'a') crate2 = Crate('DNROilGasWells', check_for_changes_gdb, check_for_changes_gdb, 'b') pallet = Pallet() pallet._crates = [crate1, crate2] update_def = Mock(return_value=(Crate.UPDATED, 'message')) lift.process_crates_for([pallet], update_def) self.assertEqual(update_def.call_count, 2) self.assertEqual(crate1.result[0], Crate.UPDATED) self.assertEqual(crate2.result[0], Crate.UPDATED)