Backport text decorations. Improve timeouts in tests. Improve TelegramAPIServer

This commit is contained in:
Alex Root Junior 2021-01-24 23:12:07 +02:00
parent 4292b3934f
commit 1a185928a2
11 changed files with 82 additions and 48 deletions

View file

@ -1,4 +1,4 @@
from aiogram.client.telegram import PRODUCTION
from aiogram.client.telegram import PRODUCTION, TelegramAPIServer
class TestAPIServer:
@ -9,3 +9,13 @@ class TestAPIServer:
def test_file_url(self):
file_url = PRODUCTION.file_url(token="42:TEST", path="path")
assert file_url == "https://api.telegram.org/file/bot42:TEST/path"
def test_from_base(self):
local_server = TelegramAPIServer.from_base("http://localhost:8081", is_local=True)
method_url = local_server.api_url("42:TEST", method="apiMethod")
file_url = local_server.file_url(token="42:TEST", path="path")
assert method_url == "http://localhost:8081/bot42:TEST/apiMethod"
assert file_url == "http://localhost:8081/file/bot42:TEST/path"
assert local_server.is_local