2024-01-30 12:50:46 +03:00
|
|
|
|
from typing import Tuple
|
|
|
|
|
|
2024-01-26 00:23:38 +03:00
|
|
|
|
import pytest
|
2024-01-30 12:50:46 +03:00
|
|
|
|
from httpx import AsyncClient, Response
|
2024-01-26 00:23:38 +03:00
|
|
|
|
|
|
|
|
|
|
2024-01-28 16:22:24 +03:00
|
|
|
|
class TestBaseCrud:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
class Menu:
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def read_all(ac: AsyncClient) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""чтение всех меню"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get("/")
|
2024-01-27 15:48:20 +03:00
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def get(ac: AsyncClient, data: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Получение меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get(f"/{data.get('id')}")
|
2024-01-27 15:48:20 +03:00
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
2024-01-27 08:55:09 +03:00
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def write(ac: AsyncClient, data: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""создания меню"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.post("/", json=data)
|
2024-01-27 15:48:20 +03:00
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
2024-01-27 08:55:09 +03:00
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def update(ac: AsyncClient, data: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Обновление меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.patch(
|
|
|
|
|
f"/{data.get('id')}",
|
|
|
|
|
json=data,
|
|
|
|
|
)
|
2024-01-27 15:48:20 +03:00
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def delete(ac: AsyncClient, data: dict) -> int:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Удаление меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.delete(f"/{data.get('id')}")
|
2024-01-28 16:22:24 +03:00
|
|
|
|
return response.status_code
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
class Submenu:
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def read_all(ac: AsyncClient, menu: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""чтение всех меню"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get(f"/{menu.get('id')}/submenus/")
|
2024-01-27 15:48:20 +03:00
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def get(ac: AsyncClient, menu: dict, submenu: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Получение меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get(
|
2024-01-27 15:48:20 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}",
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def write(ac: AsyncClient, menu: dict, submenu: dict) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""создания меню"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.post(
|
2024-01-27 15:48:20 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/",
|
|
|
|
|
json=submenu,
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def update(
|
|
|
|
|
ac: AsyncClient, menu: dict, submenu: dict
|
|
|
|
|
) -> Tuple[int, dict]:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Обновление меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.patch(
|
2024-01-27 15:48:20 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}",
|
|
|
|
|
json=submenu,
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def delete(ac: AsyncClient, menu: dict, submenu: dict) -> int:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Удаление меню по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.delete(
|
2024-01-27 15:48:20 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}"
|
|
|
|
|
)
|
2024-01-28 16:22:24 +03:00
|
|
|
|
return response.status_code
|
|
|
|
|
|
|
|
|
|
class Dish:
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def read_all(
|
|
|
|
|
ac: AsyncClient, menu: dict, submenu: dict
|
|
|
|
|
) -> Tuple[int, dict]:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
"""чтение всех блюд"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get(
|
2024-01-28 16:22:24 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}/dishes/",
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def get(
|
|
|
|
|
ac: AsyncClient, menu: dict, submenu: dict, dish: dict
|
|
|
|
|
) -> Tuple[int, dict]:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
"""Получение блюда по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.get(
|
2024-01-29 02:19:02 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}"
|
|
|
|
|
f"/dishes/{dish.get('id')}",
|
2024-01-28 16:22:24 +03:00
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def write(
|
|
|
|
|
ac: AsyncClient, menu: dict, submenu: dict, dish: dict
|
|
|
|
|
) -> Tuple[int, dict]:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
"""создания блюда"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.post(
|
2024-01-28 16:22:24 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}/dishes/",
|
|
|
|
|
json=dish,
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def update(
|
|
|
|
|
ac: AsyncClient, menu: dict, submenu: dict, dish: dict
|
|
|
|
|
) -> Tuple[int, dict]:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
"""Обновление блюда по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.patch(
|
2024-01-29 02:19:02 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}"
|
|
|
|
|
f"/dishes/{dish.get('id')}",
|
2024-01-28 16:22:24 +03:00
|
|
|
|
json=dish,
|
|
|
|
|
)
|
|
|
|
|
return response.status_code, response.json()
|
|
|
|
|
|
|
|
|
|
@staticmethod
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def delete(ac: AsyncClient, menu: dict, submenu: dict, dish: dict) -> int:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
"""Удаление блюда по id"""
|
2024-01-30 12:50:46 +03:00
|
|
|
|
response: Response = await ac.delete(
|
2024-01-29 02:19:02 +03:00
|
|
|
|
f"/{menu.get('id')}/submenus/{submenu.get('id')}"
|
|
|
|
|
f"/dishes/{dish.get('id')}"
|
2024-01-28 16:22:24 +03:00
|
|
|
|
)
|
|
|
|
|
return response.status_code
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
2024-01-26 12:52:35 +03:00
|
|
|
|
@pytest.mark.asyncio
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def test_menu_crud(self, client: AsyncClient) -> None:
|
2024-01-27 08:55:09 +03:00
|
|
|
|
"""Тестирование функций меню"""
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, rspn = await self.Menu.read_all(client)
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 200
|
|
|
|
|
|
|
|
|
|
data = {"title": "Menu", "description": None}
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, rspn = await self.Menu.write(client, data)
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 201
|
|
|
|
|
assert rspn["title"] == "Menu"
|
|
|
|
|
assert rspn["description"] is None
|
|
|
|
|
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, menu = await self.Menu.get(client, {"id": rspn.get("id")})
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 200
|
|
|
|
|
assert menu["title"] == rspn["title"]
|
|
|
|
|
|
|
|
|
|
upd_data = {
|
2024-01-27 15:48:20 +03:00
|
|
|
|
"id": rspn.get("id"),
|
|
|
|
|
"title": "upd Menu",
|
|
|
|
|
"description": "",
|
2024-01-27 08:55:09 +03:00
|
|
|
|
}
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, upd_rspn = await self.Menu.update(client, upd_data)
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 200
|
|
|
|
|
assert upd_rspn["title"] == "upd Menu"
|
|
|
|
|
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code = await self.Menu.delete(client, rspn)
|
2024-01-28 16:22:24 +03:00
|
|
|
|
assert code == 200
|
2024-01-27 08:55:09 +03:00
|
|
|
|
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, menu = await self.Menu.get(client, {"id": rspn.get("id")})
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 404
|
2024-01-26 12:52:35 +03:00
|
|
|
|
|
|
|
|
|
@pytest.mark.asyncio
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def test_submenus(self, client) -> None:
|
2024-01-27 15:48:20 +03:00
|
|
|
|
# Создаем меню и проверяем ответ
|
2024-01-27 08:55:09 +03:00
|
|
|
|
menu = {"title": "Menu", "description": "main menu"}
|
2024-01-27 15:48:20 +03:00
|
|
|
|
code, rspn = await self.Menu.write(client, menu)
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 201
|
|
|
|
|
menu.update(rspn)
|
2024-01-27 15:48:20 +03:00
|
|
|
|
|
|
|
|
|
# Проверяем наличие подменю
|
|
|
|
|
code, rspn = await self.Submenu.read_all(client, menu)
|
2024-01-27 08:55:09 +03:00
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn == []
|
2024-01-26 00:23:38 +03:00
|
|
|
|
|
2024-01-27 15:48:20 +03:00
|
|
|
|
# Создаем и проверяем подменю
|
|
|
|
|
submenu = {
|
|
|
|
|
"title": "Submenu",
|
|
|
|
|
"description": "submenu",
|
|
|
|
|
"parent_menu": menu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await self.Submenu.write(client, menu, submenu)
|
|
|
|
|
assert code == 201
|
|
|
|
|
submenu.update(rspn)
|
2024-01-26 00:23:38 +03:00
|
|
|
|
|
2024-01-27 15:48:20 +03:00
|
|
|
|
# Проверяем меню на наличие подменю
|
|
|
|
|
code, rspn = await self.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["submenus_count"] == 1
|
|
|
|
|
|
|
|
|
|
# Обновляем подменю и проверяем
|
|
|
|
|
submenu["title"] = "updated_submenu"
|
|
|
|
|
code, rspn = await self.Submenu.update(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert submenu["title"] == rspn["title"]
|
|
|
|
|
submenu.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Удаляем подменю
|
2024-01-28 16:22:24 +03:00
|
|
|
|
code = await self.Submenu.delete(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
2024-01-27 15:48:20 +03:00
|
|
|
|
|
|
|
|
|
# Проверяем меню
|
|
|
|
|
code, rspn = await self.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["submenus_count"] == 0
|
|
|
|
|
|
|
|
|
|
# Проверяем удаленное подменю
|
|
|
|
|
code, rspn = await self.Submenu.get(client, menu, submenu)
|
|
|
|
|
assert code == 404
|
|
|
|
|
|
|
|
|
|
# удаляем сопутствующее
|
|
|
|
|
await self.Menu.delete(client, menu)
|
|
|
|
|
|
2024-01-28 16:22:24 +03:00
|
|
|
|
@pytest.mark.asyncio
|
2024-01-30 12:50:46 +03:00
|
|
|
|
async def test_dishes(self, client: AsyncClient) -> None:
|
2024-01-28 16:22:24 +03:00
|
|
|
|
# Создаем меню и проверяем ответ
|
|
|
|
|
menu = {
|
|
|
|
|
"title": "Menu",
|
|
|
|
|
"description": "main menu",
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await self.Menu.write(client, menu)
|
|
|
|
|
assert code == 201
|
|
|
|
|
menu.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Создаем и проверяем подменю
|
|
|
|
|
submenu = {
|
|
|
|
|
"title": "Submenu",
|
|
|
|
|
"description": "submenu",
|
|
|
|
|
"parent_menu": menu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await self.Submenu.write(client, menu, submenu)
|
|
|
|
|
assert code == 201
|
|
|
|
|
submenu.update(rspn)
|
2024-01-27 15:48:20 +03:00
|
|
|
|
|
2024-01-28 16:22:24 +03:00
|
|
|
|
# Проверяем все блюда в подменю
|
|
|
|
|
code, rspn = await self.Dish.read_all(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn == []
|
|
|
|
|
|
|
|
|
|
# Добавляем блюдо
|
|
|
|
|
dish = {
|
|
|
|
|
"title": "dish",
|
|
|
|
|
"description": "some dish",
|
|
|
|
|
"price": "12.5",
|
|
|
|
|
"parent_submenu": submenu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await self.Dish.write(client, menu, submenu, dish)
|
|
|
|
|
assert code == 201
|
|
|
|
|
dish.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Получаем блюдо
|
|
|
|
|
code, rspn = await self.Dish.get(client, menu, submenu, dish)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["title"] == dish["title"]
|
|
|
|
|
|
|
|
|
|
# Проверяем меню на количество блюд
|
|
|
|
|
code, rspn = await self.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["dishes_count"] == 1
|
|
|
|
|
|
|
|
|
|
# Проверяем подменю на наличие блюд
|
|
|
|
|
code, rspn = await self.Submenu.get(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["dishes_count"] == 1
|
|
|
|
|
|
|
|
|
|
# Обновляем блюдо и проверяем
|
|
|
|
|
dish["title"] = "updated_dish"
|
|
|
|
|
code, rspn = await self.Dish.update(client, menu, submenu, dish)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert dish["title"] == rspn["title"]
|
|
|
|
|
dish.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Удаляем подменю
|
|
|
|
|
code = await self.Dish.delete(client, menu, submenu, dish)
|
|
|
|
|
assert code == 200
|
|
|
|
|
|
|
|
|
|
# Проверяем меню
|
|
|
|
|
code, rspn = await self.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["dishes_count"] == 0
|
|
|
|
|
|
|
|
|
|
# Проверяем подменю на наличие блюд
|
|
|
|
|
code, rspn = await self.Submenu.get(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn["dishes_count"] == 0
|
|
|
|
|
|
|
|
|
|
# Проверяем удаленное блюдо
|
|
|
|
|
code, rspn = await self.Dish.get(client, menu, submenu, dish)
|
|
|
|
|
assert code == 404
|
|
|
|
|
|
|
|
|
|
# удаляем сопутствующее
|
|
|
|
|
await self.Submenu.delete(client, menu, submenu)
|
|
|
|
|
await self.Menu.delete(client, menu)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TestСontinuity:
|
|
|
|
|
@pytest.mark.asyncio
|
|
|
|
|
async def test_postman_continuity(self, client):
|
|
|
|
|
# Создаем меню
|
|
|
|
|
menu = {
|
|
|
|
|
"title": "Menu",
|
|
|
|
|
"description": "main menu",
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await TestBaseCrud.Menu.write(client, menu)
|
|
|
|
|
assert code == 201
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
menu.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Создаем подменю
|
|
|
|
|
submenu = {
|
|
|
|
|
"title": "Submenu",
|
|
|
|
|
"description": "submenu",
|
|
|
|
|
"parent_menu": menu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await TestBaseCrud.Submenu.write(client, menu, submenu)
|
|
|
|
|
assert code == 201
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
submenu.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Добавляем блюдо1
|
|
|
|
|
dish = {
|
|
|
|
|
"title": "dish1",
|
|
|
|
|
"description": "some dish1",
|
|
|
|
|
"price": "13.50",
|
|
|
|
|
"parent_submenu": submenu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await TestBaseCrud.Dish.write(client, menu, submenu, dish)
|
|
|
|
|
assert code == 201
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
dish.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Добавляем блюдо2
|
|
|
|
|
dish = {
|
|
|
|
|
"title": "dish2",
|
|
|
|
|
"description": "some dish2",
|
|
|
|
|
"price": "12.50",
|
|
|
|
|
"parent_submenu": submenu["id"],
|
|
|
|
|
}
|
|
|
|
|
code, rspn = await TestBaseCrud.Dish.write(client, menu, submenu, dish)
|
|
|
|
|
assert code == 201
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
dish.update(rspn)
|
|
|
|
|
|
|
|
|
|
# Просматриваем конкретное меню
|
|
|
|
|
code, rspn = await TestBaseCrud.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
assert menu["id"] == rspn["id"]
|
|
|
|
|
assert "submenus_count" in rspn.keys()
|
|
|
|
|
assert rspn["submenus_count"] == 1
|
|
|
|
|
assert "dishes_count" in rspn.keys()
|
|
|
|
|
assert rspn["dishes_count"] == 2
|
|
|
|
|
|
|
|
|
|
# Просматриваем конкретное подменю
|
|
|
|
|
code, rspn = await TestBaseCrud.Submenu.get(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
assert "dishes_count" in rspn.keys()
|
|
|
|
|
assert rspn["dishes_count"] == 2
|
|
|
|
|
|
|
|
|
|
# Удаляем подменю
|
|
|
|
|
code = await TestBaseCrud.Submenu.delete(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
|
|
|
|
|
# Просматриваем список подменю
|
|
|
|
|
code, rspn = await TestBaseCrud.Submenu.read_all(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn == []
|
|
|
|
|
|
|
|
|
|
# Просматриваем список блюд
|
|
|
|
|
code, rspn = await TestBaseCrud.Dish.read_all(client, menu, submenu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn == []
|
|
|
|
|
|
|
|
|
|
# Просматриваем конкретное меню
|
|
|
|
|
code, rspn = await TestBaseCrud.Menu.get(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert "id" in rspn.keys()
|
|
|
|
|
assert menu["id"] == rspn["id"]
|
|
|
|
|
assert "submenus_count" in rspn.keys()
|
|
|
|
|
assert rspn["submenus_count"] == 0
|
|
|
|
|
assert "dishes_count" in rspn.keys()
|
|
|
|
|
assert rspn["dishes_count"] == 0
|
2024-01-29 02:19:02 +03:00
|
|
|
|
|
2024-01-28 16:22:24 +03:00
|
|
|
|
# Удаляем меню
|
|
|
|
|
code = await TestBaseCrud.Menu.delete(client, menu)
|
|
|
|
|
assert code == 200
|
|
|
|
|
|
|
|
|
|
# Просматриваем все меню
|
|
|
|
|
code, rspn = await TestBaseCrud.Menu.read_all(client)
|
|
|
|
|
assert code == 200
|
|
|
|
|
assert rspn == []
|