Example #1
0
def edit(request, id):
    if id:
        dados = {
            'title': 'Atualizar ingrediente',
            'header': 'Atualizar ingrediente',
            'icon': 'fas fa-bacon',
            'ingredient': Ingredient.get_info_by_id(id)
        }

        return render(request, 'ingredient/create.html', dados)
    else:
        messages.error(request, "Erro no envio")
Example #2
0
 def test_get_value_ingredient(self):
     ingredient = Ingredient.get_info_by_id(1)
     self.assertEqual(ingredient.price.value, 1.25)
Example #3
0
    def test_get_ingredient_update(self):
        Ingredient.update(2, "Bacon", 2.45)
        ingredient = Ingredient.get_info_by_id(2)

        ingredient.price.value = float(ingredient.price.value)
        self.assertEqual(ingredient.price.value, 2.45)