def test_add_ingredient(self): new_ingredient = { "name" : "Gnocchi" } self.assertTrue(libs.add_new_ingredient(new_ingredient, db= self.db)) self.assertTrue(libs.get_ingredient_by_slug('gnocchi', db= self.db))
def test_ingredient_not_added_twice(self): ingredients = len(libs.get_ingredient_names(db= self.db)) libs.add_new_ingredient({ "name" : "Pepper"}, db= self.db) self.assertEqual(ingredients, len(libs.get_ingredient_names(db= self.db)))