add ci tests in docker compose (#11)

This commit is contained in:
Dmitry Afanasyev
2023-09-26 13:28:34 +03:00
committed by GitHub
parent e8ace80d68
commit 4e97baf525
8 changed files with 26 additions and 26 deletions

View File

@@ -40,6 +40,8 @@ class BotApplication:
logger.info("webhook has been deleted")
async def polling(self) -> None:
if self.settings.STAGE == "runtests":
return None
await self.application.initialize()
await self.application.start()
await self.application.updater.start_polling() # type: ignore

View File

@@ -13,7 +13,7 @@ DOMAIN="http://localhost"
URL_PREFIX=
# set to true to start with webhook. Else bot will start on polling method
START_WITH_WEBHOOK="true"
START_WITH_WEBHOOK="false"
# quantity of workers for uvicorn
WORKERS_COUNT=1

View File

@@ -13,7 +13,7 @@ DOMAIN="http://localhost"
URL_PREFIX=
# set to true to start with webhook. Else bot will start on polling method
START_WITH_WEBHOOK="true"
START_WITH_WEBHOOK="false"
# quantity of workers for uvicorn
WORKERS_COUNT=1

View File

@@ -1,10 +1,11 @@
from functools import cached_property
from os import environ
from pathlib import Path
from typing import Any
from constants import API_PREFIX
from dotenv import load_dotenv
from pydantic import HttpUrl
from pydantic import HttpUrl, ValidationInfo, field_validator
from pydantic_settings import BaseSettings
BASE_DIR = Path(__file__).parent.parent
@@ -51,6 +52,12 @@ class AppSettings(SentrySettings, BaseSettings):
# Enable uvicorn reloading
RELOAD: bool = False
@field_validator("START_WITH_WEBHOOK")
def star_with_webhook_validator(cls, field_value: Any, info: ValidationInfo) -> Any:
if field_value == "false":
return False
return field_value
@cached_property
def api_prefix(self) -> str:
if self.URL_PREFIX: