Example #1
0
 def test_parent_data(self):
     recipe = new_recipe(**sunny_side_up)
     old_data_id = recipe.data.id
     update_recipe(recipe.id,
                   ingredients=sunny_side_up_v2['ingredients'],
                   steps=sunny_side_up_v2['steps'])
     self.assertEquals(recipe.data.parent.id, old_data_id)
Example #2
0
def insert_all():
    recipe = new_recipe(**sunny_side_up)
    update_recipe(recipe.id,
                  ingredients=sunny_side_up_v2['ingredients'],
                  steps=sunny_side_up_v2['steps'],
                  message=sunny_side_up_v2['message'])
    new_recipe(**begun_bhaja)
Example #3
0
 def test_update_recipe(self):
     recipe = new_recipe(**sunny_side_up)
     update_recipe(recipe.id,
                   ingredients=sunny_side_up_v2['ingredients'],
                   steps=sunny_side_up_v2['steps'])
     self.assertEqual(db.session.query(db.Recipe).count(), 1)
     self.assertEqual(db.session.query(db.RecipeData).count(), 2)
     recipe = db.session.query(db.Recipe).first()
     self.assertIn("cheese", recipe.data.ingredients)
Example #4
0
 def put(self, recipe_id):
     recipe_data = json.loads(request.data)
     if not recipe_data.get('ingredients') or not recipe_data.get('steps'):
         raise BadRequest
     return update_recipe(recipe_id,
                          ingredients=recipe_data['ingredients'],
                          steps=recipe_data['steps'],
                          message=recipe_data.get('message'),
                          title=recipe_data.get('title'),
                          description=recipe_data.get('description'))