def test_delete(s3): Recipe(name="nachos", instructions="Melt cheese on chips").save() response = s3.list_objects_v2(Bucket=S3_BUCKET) assert len(response["Contents"]) == 1 assert response["Contents"][0]["Key"] == "nachos" Recipe.delete("nachos") # Data in S3 is gone after deleting the recipe response = s3.list_objects_v2(Bucket=S3_BUCKET) assert "Contents" not in response.keys()
def delete_recipe(recipe_id): Recipe.delete(recipe_id) return redirect("/")