This commit is contained in:
sheldy 2023-05-25 21:42:07 +03:00
parent 66631181af
commit 435f4f8b77
2 changed files with 17 additions and 0 deletions

View file

@ -264,6 +264,9 @@ class TokenBasedRequestHandler(BaseRequestHandler):
self.bot_settings = bot_settings
self.bots: Dict[str, Bot] = {}
def verify_secret(self, telegram_secret_token: str) -> bool:
pass
async def close(self) -> None:
for bot in self.bots.values():
await bot.session.close()

View file

@ -189,6 +189,20 @@ class TestSimpleRequestHandler:
result = await resp.json()
assert not result
async def test_verify_secret(self, bot: MockedBot, aiohttp_client):
app = Application()
dp = Dispatcher()
handler = SimpleRequestHandler(
dispatcher=dp,
bot=bot,
handle_in_background=False,
secret_token="vasya228"
)
handler.register(app, path="/webhook")
client: TestClient = await aiohttp_client(app)
resp = await self.make_reqest(client=client)
assert resp.status == 401
class TestTokenBasedRequestHandler:
async def test_register(self):