mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-19 05:09:40 +02:00
feat: Change Recipe Owner (#4355)
Co-authored-by: boc-the-git <3479092+boc-the-git@users.noreply.github.com>
This commit is contained in:
parent
60ea83d737
commit
1dc7b24146
11 changed files with 187 additions and 14 deletions
|
@ -483,6 +483,30 @@ def test_read_update(
|
|||
assert cats[0]["name"] in test_name
|
||||
|
||||
|
||||
def test_update_many(api_client: TestClient, unique_user: TestUser):
|
||||
recipe_slugs = [random_string() for _ in range(3)]
|
||||
for slug in recipe_slugs:
|
||||
api_client.post(api_routes.recipes, json={"name": slug}, headers=unique_user.token)
|
||||
|
||||
recipes_data: list[dict] = [
|
||||
json.loads(api_client.get(api_routes.recipes_slug(slug), headers=unique_user.token).text)
|
||||
for slug in recipe_slugs
|
||||
]
|
||||
|
||||
new_slug_by_id = {r["id"]: random_string() for r in recipes_data}
|
||||
for recipe_data in recipes_data:
|
||||
recipe_data["name"] = new_slug_by_id[recipe_data["id"]]
|
||||
recipe_data["slug"] = new_slug_by_id[recipe_data["id"]]
|
||||
|
||||
response = api_client.put(api_routes.recipes, json=recipes_data, headers=unique_user.token)
|
||||
assert response.status_code == 200
|
||||
for updated_recipe_data in response.json():
|
||||
assert updated_recipe_data["slug"] == new_slug_by_id[updated_recipe_data["id"]]
|
||||
get_response = api_client.get(api_routes.recipes_slug(updated_recipe_data["slug"]), headers=unique_user.token)
|
||||
assert get_response.status_code == 200
|
||||
assert get_response.json()["slug"] == updated_recipe_data["slug"]
|
||||
|
||||
|
||||
def test_duplicate(api_client: TestClient, unique_user: TestUser):
|
||||
recipe_data = recipe_test_data[0]
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue