Beispiel #1
0
 def test_get_recipes_for_users(self):
     user_ids = [22, 23, 24]
     for user_id in user_ids:
         new_recipe(sunny_side_up['title'], sunny_side_up['description'], user_id, sunny_side_up['ingredients'], sunny_side_up['steps'])
     recipes = get_recipes_for_users(user_ids)
     recipe_users = list(set([recipe['user_id'] for recipe in recipes]))
     self.assertEqual(sorted(user_ids), sorted(recipe_users))
Beispiel #2
0
 def test_version_list(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     updated_recipe = update_recipe(recipe['id'], sunny_side_up_v2['ingredients'], sunny_side_up_v2['steps'], message=sunny_side_up_v2['message'])
     self.assertEqual(len(get_versions(recipe['id'])), 2)
     version_ids = [x[0] for x in get_versions(recipe['id'])]
     updated_version_ids = [x[0] for x in get_versions(updated_recipe['id'])]
     self.assertIn(recipe['data']['id'], version_ids)
     self.assertIn(recipe['data']['id'], updated_version_ids)
Beispiel #3
0
 def test_recipe_version(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     updated_recipe = update_recipe(recipe['id'], sunny_side_up_v2['ingredients'], sunny_side_up_v2['steps'])
     old_version = get_recipe_version(updated_recipe['id'], recipe['data']['id'])
     self.assertNotIn("cheese", old_version['data']['ingredients'])
Beispiel #4
0
 def test_fork_list(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     forked_recipe = fork_recipe(22, recipe['id'])
     self.assertEqual(len(get_forks(recipe['id'])), 1)
Beispiel #5
0
 def test_fork_recipe(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     forked_recipe = fork_recipe(22, recipe['id'])
     self.assertNotEqual(recipe['id'], forked_recipe['id'])
     self.assertEqual(recipe['data']['id'], forked_recipe['data']['id'])
     self.assertEqual(recipe['id'], forked_recipe['fork_of_id'])
Beispiel #6
0
 def test_update_recipe(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     updated_recipe = update_recipe(recipe['id'], sunny_side_up_v2['ingredients'], sunny_side_up_v2['steps'])
     self.assertNotEqual(recipe['data']['id'], updated_recipe['data']['id'])
Beispiel #7
0
 def test_get_recipe(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     recipe_from_server = get_recipe(recipe['id'])
     self.assertEqual(sunny_side_up['title'], recipe_from_server['title'])
Beispiel #8
0
 def test_new_recipe(self):
     recipe = new_recipe(sunny_side_up['title'], sunny_side_up['description'], 22, sunny_side_up['ingredients'], sunny_side_up['steps'])
     self.assertEqual(sunny_side_up['title'], recipe['title'])