def test_cat_pet_shop_shall_show_cat_instance(self): f = CatFactory() with patch.object(f, 'get_pet') as mock_f_get_pet,\ patch.object(f, 'get_food') as mock_f_get_food: ps = PetShop(f) ps.show_pet() self.assertEqual(mock_f_get_pet.call_count, 1) self.assertEqual(mock_f_get_food.call_count, 1)
def test_dog_pet_shop_shall_show_dog_instance(self): dog_pet_shop = PetShop(Dog) with patch.object(Dog, 'speak') as mock_Dog_speak: dog_pet_shop.show_pet() self.assertEqual(mock_Dog_speak.call_count, 1)