fix
parent
e6d1070d9a
commit
f28637f5dd
|
@ -75,7 +75,7 @@ class Settings(BaseSettings):
|
||||||
if os.path.exists(file_path):
|
if os.path.exists(file_path):
|
||||||
return 'amqp://guest:guest@rabbitmq'
|
return 'amqp://guest:guest@rabbitmq'
|
||||||
|
|
||||||
# return f"redis://{self.REDIS_HOST}:{self.REDIS_PORT}/{self.REDIS_DB}"
|
return f'redis://{self.REDIS_HOST}:{self.REDIS_PORT}/{self.REDIS_DB}'
|
||||||
|
|
||||||
model_config = SettingsConfigDict(env_file='.env')
|
model_config = SettingsConfigDict(env_file='.env')
|
||||||
|
|
||||||
|
|
|
@ -12,17 +12,13 @@ async def test_summary_with_menu(client: AsyncClient) -> None:
|
||||||
assert rspn == []
|
assert rspn == []
|
||||||
|
|
||||||
# Создаем меню и проверяем ответ
|
# Создаем меню и проверяем ответ
|
||||||
menu = {
|
menu = {'title': 'Menu', 'description': 'main menu', 'submenus': []}
|
||||||
'title': 'Menu',
|
|
||||||
'description': 'main menu',
|
|
||||||
}
|
|
||||||
code, rspn = await Repo.Menu.write(client, menu)
|
code, rspn = await Repo.Menu.write(client, menu)
|
||||||
menu.update(rspn)
|
menu.update(rspn)
|
||||||
|
|
||||||
# Удалим ненужные ключи, тк в модели они не используются
|
# Удалим ненужные ключи, тк в модели они не используются
|
||||||
del menu['submenus_count']
|
del menu['submenus_count']
|
||||||
del menu['dishes_count']
|
del menu['dishes_count']
|
||||||
menu.__setattr__('submenus', list())
|
|
||||||
|
|
||||||
# Проверяем summary c меню
|
# Проверяем summary c меню
|
||||||
code, rspn = await Repo.Summary.read_summary(client)
|
code, rspn = await Repo.Summary.read_summary(client)
|
||||||
|
@ -36,30 +32,30 @@ async def test_summary_with_menu(client: AsyncClient) -> None:
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_summary_with_submenus(client: AsyncClient) -> None:
|
async def test_summary_with_submenus(client: AsyncClient) -> None:
|
||||||
# Создаем меню и проверяем ответ
|
# Создаем меню и проверяем ответ
|
||||||
menu = {
|
menu: dict[str, str | list | float] = {
|
||||||
'title': 'Menu',
|
'title': 'Menu',
|
||||||
'description': 'main menu',
|
'description': 'main menu',
|
||||||
|
'submenus': [],
|
||||||
}
|
}
|
||||||
code, rspn = await Repo.Menu.write(client, menu)
|
code, rspn = await Repo.Menu.write(client, menu)
|
||||||
menu.update(rspn)
|
menu.update(rspn)
|
||||||
|
|
||||||
del menu['submenus_count']
|
del menu['submenus_count']
|
||||||
del menu['dishes_count']
|
del menu['dishes_count']
|
||||||
menu.__setattr__('submenus', list())
|
|
||||||
|
|
||||||
# Создаем и проверяем подменю
|
# Создаем и проверяем подменю
|
||||||
submenu = {
|
submenu: dict[str, str | list | float] = {
|
||||||
'title': 'Submenu',
|
'title': 'Submenu',
|
||||||
'description': 'submenu',
|
'description': 'submenu',
|
||||||
'parent_menu': menu['id'],
|
'parent_menu': menu['id'],
|
||||||
|
'dishes': list(),
|
||||||
}
|
}
|
||||||
code, rspn = await Repo.Submenu.write(client, menu, submenu)
|
code, rspn = await Repo.Submenu.write(client, menu, submenu)
|
||||||
submenu.update(rspn)
|
submenu.update(rspn)
|
||||||
submenu.__setattr__('dishes', list())
|
|
||||||
del submenu['dishes_count']
|
del submenu['dishes_count']
|
||||||
del submenu['parent_menu']
|
del submenu['parent_menu']
|
||||||
|
|
||||||
menu.__setattr__('submenus', [submenu])
|
menu['submenus'] = [submenu]
|
||||||
|
|
||||||
# Получаем блюдо
|
# Получаем блюдо
|
||||||
code, rspn = await Repo.Summary.read_summary(client)
|
code, rspn = await Repo.Summary.read_summary(client)
|
||||||
|
@ -72,26 +68,26 @@ async def test_summary_with_submenus(client: AsyncClient) -> None:
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
async def test_summary_with_dishes(client: AsyncClient) -> None:
|
async def test_summary_with_dishes(client: AsyncClient) -> None:
|
||||||
# Создаем меню и проверяем ответ
|
# Создаем меню и проверяем ответ
|
||||||
menu = {
|
menu: dict[str, str | list | float] = {
|
||||||
'title': 'Menu',
|
'title': 'Menu',
|
||||||
'description': 'main menu',
|
'description': 'main menu',
|
||||||
|
'submenus': [],
|
||||||
}
|
}
|
||||||
code, rspn = await Repo.Menu.write(client, menu)
|
code, rspn = await Repo.Menu.write(client, menu)
|
||||||
menu.update(rspn)
|
menu.update(rspn)
|
||||||
|
|
||||||
del menu['submenus_count']
|
del menu['submenus_count']
|
||||||
del menu['dishes_count']
|
del menu['dishes_count']
|
||||||
menu.__setattr__('submenus', list())
|
|
||||||
|
|
||||||
# Создаем и проверяем подменю
|
# Создаем и проверяем подменю
|
||||||
submenu = {
|
submenu: dict[str, str | list | float] = {
|
||||||
'title': 'Submenu',
|
'title': 'Submenu',
|
||||||
'description': 'submenu',
|
'description': 'submenu',
|
||||||
'parent_menu': menu['id'],
|
'parent_menu': menu['id'],
|
||||||
|
'dishes': [],
|
||||||
}
|
}
|
||||||
code, rspn = await Repo.Submenu.write(client, menu, submenu)
|
code, rspn = await Repo.Submenu.write(client, menu, submenu)
|
||||||
submenu.update(rspn)
|
submenu.update(rspn)
|
||||||
submenu.__setattr__('dishes', list())
|
|
||||||
del submenu['dishes_count']
|
del submenu['dishes_count']
|
||||||
del submenu['parent_menu']
|
del submenu['parent_menu']
|
||||||
|
|
||||||
|
@ -107,8 +103,8 @@ async def test_summary_with_dishes(client: AsyncClient) -> None:
|
||||||
del dish['parent_submenu']
|
del dish['parent_submenu']
|
||||||
del dish['id']
|
del dish['id']
|
||||||
|
|
||||||
submenu.__setattr__('dishes', dish)
|
submenu['dishes'] = [dish]
|
||||||
menu.__setattr__('submenus', submenu)
|
menu['submenus'] = [submenu]
|
||||||
|
|
||||||
code, rspn = await Repo.Summary.read_summary(client)
|
code, rspn = await Repo.Summary.read_summary(client)
|
||||||
assert code == 200
|
assert code == 200
|
||||||
|
|
Loading…
Reference in New Issue