def try_remove_ingredient(sandwich_id, ingredient_id): sandwich = get_by_id(sandwich_id) ingredient = Ingredient.get_by_id(ingredient_id) if sandwich and ingredient: models.SandwichIngredient.objects.get(ingredient=ingredient, sandwich=sandwich).delete()
def test_set_value_ingredient_id_2(self): ingredient = Ingredient.get_by_id(2) ingredient_value = Ingredient.set_value(ingredient, 1.25) self.assertEqual(ingredient_value.value, 1.25)
def test_set_value_ingredient_id_1(self): ingredient = Ingredient.get_by_id(1) ingredient_value = Ingredient.set_value(ingredient, 1.50) self.assertEqual(ingredient_value.value, 1.5)
def test_get_ingredient_update_name(self): Ingredient.update_name(2, "Bacon") ingredient = Ingredient.get_by_id(2) self.assertEqual(ingredient.name, "Bacon")
def test_get_ingredient_by_id(self): ingredient = Ingredient.get_by_id(1) self.assertEqual(ingredient.name, "Pão")