mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-09-19 02:12:40 +03:00
Add reconnection policy to test for encrypted method invocation
This commit is contained in:
parent
3bfa64a5d6
commit
e3165bc3bf
|
@ -5,6 +5,7 @@ from pytest import LogCaptureFixture, mark
|
||||||
|
|
||||||
from telethon._impl.mtproto import Full
|
from telethon._impl.mtproto import Full
|
||||||
from telethon._impl.mtsender import connect
|
from telethon._impl.mtsender import connect
|
||||||
|
from telethon._impl.mtsender.reconnection import NoReconnect
|
||||||
from telethon._impl.tl import LAYER, abcs, functions, types
|
from telethon._impl.tl import LAYER, abcs, functions, types
|
||||||
|
|
||||||
TELEGRAM_TEST_DC = 2, "149.154.167.40:443"
|
TELEGRAM_TEST_DC = 2, "149.154.167.40:443"
|
||||||
|
@ -21,6 +22,8 @@ async def test_invoke_encrypted_method(caplog: LogCaptureFixture) -> None:
|
||||||
def timeout() -> float:
|
def timeout() -> float:
|
||||||
return deadline - asyncio.get_running_loop().time()
|
return deadline - asyncio.get_running_loop().time()
|
||||||
|
|
||||||
|
reconnection_policy = NoReconnect()
|
||||||
|
|
||||||
sender = await asyncio.wait_for(
|
sender = await asyncio.wait_for(
|
||||||
connect(
|
connect(
|
||||||
Full(),
|
Full(),
|
||||||
|
@ -28,6 +31,7 @@ async def test_invoke_encrypted_method(caplog: LogCaptureFixture) -> None:
|
||||||
auth_key=None,
|
auth_key=None,
|
||||||
base_logger=logging.getLogger(__file__),
|
base_logger=logging.getLogger(__file__),
|
||||||
connector=lambda ip, port: asyncio.open_connection(ip, port),
|
connector=lambda ip, port: asyncio.open_connection(ip, port),
|
||||||
|
reconnection_policy=reconnection_policy,
|
||||||
),
|
),
|
||||||
timeout(),
|
timeout(),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user