mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Remove path to string convertion (#1612)
* Remove path to string conversion * docs: changelog added
This commit is contained in:
parent
b376949647
commit
44bd8fe103
5 changed files with 17 additions and 10 deletions
|
|
@ -1,5 +1,7 @@
|
|||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from aiogram.client.telegram import (
|
||||
PRODUCTION,
|
||||
BareFilesPathWrapper,
|
||||
|
|
@ -13,15 +15,17 @@ class TestAPIServer:
|
|||
method_url = PRODUCTION.api_url(token="42:TEST", method="apiMethod")
|
||||
assert method_url == "https://api.telegram.org/bot42:TEST/apiMethod"
|
||||
|
||||
def test_file_url(self):
|
||||
file_url = PRODUCTION.file_url(token="42:TEST", path="path")
|
||||
@pytest.mark.parametrize("path", ["path", Path("path")])
|
||||
def test_file_url(self, path):
|
||||
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):
|
||||
@pytest.mark.parametrize("path", ["path", Path("path")])
|
||||
def test_from_base(self, path):
|
||||
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")
|
||||
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"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue