Beispiel #1
0
    def test_save_extracted_data(self):
        recipe_bo = RecipeBO()

        data = [{
            "title": "test recipe",
            "steps": ["step 1", "step 2", "step 3"],
            "ingredients": ["ingredient 1", "ingredient 2", "ingredient 3"]
        }]

        with open('data.json', 'w') as fp:
            json.dump(data, fp)

        f = open("data.json")
        data_id = recipe_bo.save_extracted_data(f.read())

        recipe = recipe_bo.list_full_recipe_by_id(data_id)

        self.assertEqual(recipe['title'], data[0]['title'])
        self.assertEqual(recipe['ingredients'], data[0]['ingredients'])
        self.assertEqual(recipe['steps'], data[0]['steps'])
Beispiel #2
0
    def test_save_extracted_data(self):
        recipe_bo = RecipeBO()

        data = [
            {
                "title": "test recipe",
                "steps": ["step 1", "step 2", "step 3"],
                "ingredients": ["ingredient 1", "ingredient 2", "ingredient 3"],
            }
        ]

        with open("data.json", "w") as fp:
            json.dump(data, fp)

        f = open("data.json")
        data_id = recipe_bo.save_extracted_data(f.read())

        recipe = recipe_bo.list_full_recipe_by_id(data_id)

        self.assertEqual(recipe["title"], data[0]["title"])
        self.assertEqual(recipe["ingredients"], data[0]["ingredients"])
        self.assertEqual(recipe["steps"], data[0]["steps"])
Beispiel #3
0
# Run a test server.
from fastfood import app
from fastfood.business.db_business import RecipeBO, StepBO, RecipeItemBO
import json

rbo = RecipeBO()
f = open("items.json")
rbo.save_extracted_data(f.read())

# running the app now with gunicorn run:app

#ribo = RecipeItemBO()

#ribo.filter_by_items(['ovo', 'chocolate'])

#recipes = rbo.list_recipes_by_items(['ovo', 'chocolate'])
#print json.dumps(recipes)

#if __name__ == '__main__':
#	app.run(debug=True)