mirror of
https://github.com/Balshgit/gpt_chat_bot.git
synced 2025-12-16 21:20:39 +03:00
refactoring (#26)
This commit is contained in:
@@ -11,7 +11,7 @@ from httpx import AsyncClient, Response
|
||||
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Update
|
||||
|
||||
from constants import BotStagesEnum
|
||||
from core.bot import BotApplication, BotQueue
|
||||
from core.bot.app import BotApplication, BotQueue
|
||||
from main import Application
|
||||
from settings.config import AppSettings, settings
|
||||
from tests.integration.bot.networking import MockedRequest
|
||||
@@ -37,7 +37,7 @@ async def test_bot_webhook_endpoint(
|
||||
main_application: Application,
|
||||
) -> None:
|
||||
bot_update = BotUpdateFactory(message=BotMessageFactory.create_instance(text="/help"))
|
||||
response = await rest_client.post(url="/api/123456789:AABBCCDDEEFFaabbccddeeff-1234567890", json=bot_update)
|
||||
response = await rest_client.post(url="/api/CDDEEFFaabbccdd", json=bot_update)
|
||||
assert response.status_code == 202
|
||||
update = await main_application.fastapi_app.state._state["queue"].queue.get()
|
||||
update = update.to_dict()
|
||||
|
||||
@@ -14,8 +14,8 @@ from pytest_asyncio.plugin import SubRequest
|
||||
from telegram import Bot, User
|
||||
from telegram.ext import Application, ApplicationBuilder, Defaults, ExtBot
|
||||
|
||||
from core.bot import BotApplication
|
||||
from core.handlers import bot_event_handlers
|
||||
from core.bot.app import BotApplication
|
||||
from core.bot.handlers import bot_event_handlers
|
||||
from main import Application as AppApplication
|
||||
from settings.config import AppSettings, get_settings
|
||||
from tests.integration.bot.networking import NonchalantHttpxRequest
|
||||
|
||||
@@ -3,6 +3,7 @@ import pytest
|
||||
from faker import Faker
|
||||
from httpx import AsyncClient, Response
|
||||
|
||||
from api.exceptions import BaseAPIException
|
||||
from settings.config import AppSettings
|
||||
from tests.integration.utils import mocked_ask_question_api
|
||||
|
||||
@@ -50,7 +51,7 @@ async def test_bot_healthcheck_not_ok(
|
||||
) -> None:
|
||||
with mocked_ask_question_api(
|
||||
host=test_settings.GPT_BASE_HOST,
|
||||
side_effect=Exception(),
|
||||
side_effect=BaseAPIException(),
|
||||
):
|
||||
response = await rest_client.get("/api/bot-healthcheck")
|
||||
assert response.status_code == httpx.codes.INTERNAL_SERVER_ERROR
|
||||
Reference in New Issue
Block a user