Exemplo n.º 1
0
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()
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def test_get_ingredient_update_name(self):
     Ingredient.update_name(2, "Bacon")
     ingredient = Ingredient.get_by_id(2)
     self.assertEqual(ingredient.name, "Bacon")
Exemplo n.º 5
0
 def test_get_ingredient_by_id(self):
     ingredient = Ingredient.get_by_id(1)
     self.assertEqual(ingredient.name, "Pão")