mirror of
https://github.com/aiogram/aiogram.git
synced 2025-12-12 10:11:52 +00:00
parent
5b20f81654
commit
a890622e40
3 changed files with 38 additions and 1 deletions
|
|
@ -189,8 +189,24 @@ 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_verify_secret(self, bot: MockedBot):
|
||||
dispatcher = Dispatcher()
|
||||
handler = TokenBasedRequestHandler(dispatcher=dispatcher)
|
||||
assert handler.verify_secret("petro328", bot)
|
||||
|
||||
async def test_register(self):
|
||||
dispatcher = Dispatcher()
|
||||
app = Application()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue