mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Refactor aiogram/utils/auth_widget.py
+ fix check auth widget token in BaseBot, fix tests
This commit is contained in:
parent
9b2971a525
commit
7863f052d9
6 changed files with 103 additions and 46 deletions
18
tests/test_bot/test_api.py
Normal file
18
tests/test_bot/test_api.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import pytest
|
||||
from aiogram.bot.api import check_token
|
||||
|
||||
from aiogram.utils.exceptions import ValidationError
|
||||
|
||||
|
||||
VALID_TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff-1234567890'
|
||||
INVALID_TOKEN = '123456789:AABBCCDDEEFFaabbccddeeff 123456789' # Space in token and wrong length
|
||||
|
||||
|
||||
class Test_check_token:
|
||||
|
||||
def test_valid(self):
|
||||
assert check_token(VALID_TOKEN) is True
|
||||
|
||||
def test_invalid_token(self):
|
||||
with pytest.raises(ValidationError):
|
||||
check_token(INVALID_TOKEN)
|
||||
Loading…
Add table
Add a link
Reference in a new issue