This commit is contained in:
smilerz
2024-07-09 08:01:39 -05:00
parent c4ff29beda
commit a02582e9f8
7 changed files with 28 additions and 145 deletions

View File

@@ -51,7 +51,7 @@ def test_list_space(obj_1, obj_2, u1_s1, u1_s2, space_2):
['g1_s2', 403],
['u1_s2', 404],
['a1_s2', 404],
])
], ids=str)
def test_update(arg, request, obj_1):
c = request.getfixturevalue(arg[0])
r = c.patch(

View File

@@ -273,12 +273,12 @@ def test_search_units(found_recipe, recipes, u1_s1, space_1):
('fuzzy_lookups', True), ('fuzzy_lookups', False)
],
[('unaccent', True), ('unaccent', False)]
), indirect=['user1'])
), indirect=['user1'], ids=str)
@pytest.mark.parametrize("found_recipe, param_type", [
({'unit': True}, 'unit'),
({'keyword': True}, 'keyword'),
({'food': True}, 'food'),
], indirect=['found_recipe'])
], indirect=['found_recipe'], ids=str)
def test_fuzzy_lookup(found_recipe, recipes, param_type, user1, space_1):
with scope(space=space_1):
list_url = f'api:{param_type}-list'
@@ -306,14 +306,14 @@ def test_fuzzy_lookup(found_recipe, recipes, param_type, user1, space_1):
('istartswith', True), ('istartswith', False),
],
[('unaccent', True), ('unaccent', False)]
), indirect=['user1'])
), indirect=['user1'], ids=str)
@pytest.mark.parametrize("found_recipe", [
({'name': True}),
({'description': True}),
({'instruction': True}),
({'keyword': True}),
({'food': True}),
], indirect=['found_recipe'])
], indirect=['found_recipe'], ids=str)
# user array contains: user client, expected count of search, expected count of mispelled search, search string, mispelled search string, user search preferences
def test_search_string(found_recipe, recipes, user1, space_1):
with scope(space=space_1):

View File

@@ -19,6 +19,23 @@ DATA_DIR = "cookbook/tests/other/test_data/"
# plus the test that previously existed
# plus the custom scraper that was created
# plus any specific defects discovered along the way
RECIPES = [
ALLRECIPES,
AMERICAS_TEST_KITCHEN,
CHEF_KOCH,
CHEF_KOCH2, # test for empty ingredient in ingredient_parser
COOKPAD,
COOKS_COUNTRY,
DELISH,
FOOD_NETWORK,
GIALLOZAFFERANO,
JOURNAL_DES_FEMMES,
MADAME_DESSERT, # example of json only source
MARMITON,
TASTE_OF_HOME,
THE_SPRUCE_EATS, # example of non-json recipes_scraper
TUDOGOSTOSO,
]
@pytest.mark.parametrize("arg", [
@@ -32,29 +49,7 @@ def test_import_permission(arg, request):
assert c.get(reverse(IMPORT_SOURCE_URL)).status_code == arg[1]
@pytest.mark.parametrize("arg", [
ALLRECIPES,
# test of custom scraper ATK
AMERICAS_TEST_KITCHEN,
CHEF_KOCH,
# test for empty ingredient in ingredient_parser
CHEF_KOCH2,
COOKPAD,
# test of custom scraper ATK
COOKS_COUNTRY,
DELISH,
FOOD_NETWORK,
GIALLOZAFFERANO,
JOURNAL_DES_FEMMES,
# example of recipes_scraper in with wildmode
# example of json only source
MADAME_DESSERT,
MARMITON,
TASTE_OF_HOME,
# example of non-json recipes_scraper
THE_SPRUCE_EATS, # TODO seems to be broken in recipe scrapers
TUDOGOSTOSO,
])
@pytest.mark.parametrize("arg", RECIPES, ids=[x['file'][0] for x in RECIPES])
def test_recipe_import(arg, u1_s1):
url = arg['url']
for f in list(arg['file']): # url and files get popped later