mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
tests
This commit is contained in:
parent
66631181af
commit
435f4f8b77
2 changed files with 17 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue