def test_put_list(self, client, recipes): recipe_1, recipe_2 = recipes recipe_1['name'] = 'foo' recipe_1['utensils'] = [] recipe_1['directions'].append( {'title': 'step_3','text': 'instruction recipe 1 step 3'} ) ingrs = recipe_1.pop('ingredients') recipe_2['ingredients'] = ingrs recipe_1_expected = utils.dict_merge(recipe_1, {'ingredients': ingrs}) expected = {'recipes': [recipe_1_expected, recipe_2]} super(TestRecipes, self).test_put_list(client, recipes, expected)
def test_put(self, client, recipe): recipe['name'] = 'recipe_foo' expected = utils.dict_merge(recipe) utensils = recipe.pop('utensils') ingredients = recipe.pop('ingredients') recipe.pop('directions') super(TestRecipes, self).test_put(client, recipe, {'recipe': expected}) expected['utensils'].pop() expected['ingredients'].pop() recipe['utensils'] = expected['utensils'] recipe['ingredients'] = expected['ingredients'] super(TestRecipes, self).test_put(client, recipe, {'recipe': expected})
def test_post(self, client, next_id): data = {'name': 'ingredient_1'} data_expected = { 'ingredient': utils.dict_merge(data, {'id': next_id()}) } super(TestIngredients, self).test_post(client, data, data_expected)
def test_post(self, client, next_id): data = {'name': 'utensil_1'} data_expected = { 'utensil': utils.dict_merge(data, {'id': next_id()}) } super(TestUtensils, self).test_post(client, data, data_expected)