2023-08-31 11:48:59 +03:00
|
|
|
import asyncio
|
|
|
|
import logging
|
|
|
|
|
2023-08-31 11:54:50 +03:00
|
|
|
from pytest import LogCaptureFixture
|
2023-08-31 11:48:59 +03:00
|
|
|
from telethon._impl.mtproto.transport.full import Full
|
|
|
|
from telethon._impl.mtsender.sender import connect
|
|
|
|
|
|
|
|
TELEGRAM_TEST_DC_2 = "149.154.167.40:443"
|
|
|
|
|
|
|
|
TELEGRAM_DEFAULT_TEST_DC = TELEGRAM_TEST_DC_2
|
|
|
|
|
|
|
|
TEST_TIMEOUT = 10000
|
|
|
|
|
|
|
|
|
2023-08-31 11:54:50 +03:00
|
|
|
def test_invoke_encrypted_method(caplog: LogCaptureFixture) -> None:
|
2023-08-31 11:48:59 +03:00
|
|
|
caplog.set_level(logging.DEBUG)
|
|
|
|
|
2023-08-31 11:54:50 +03:00
|
|
|
async def func() -> None:
|
2023-08-31 11:48:59 +03:00
|
|
|
deadline = asyncio.get_running_loop().time() + TEST_TIMEOUT
|
|
|
|
|
2023-08-31 11:54:50 +03:00
|
|
|
def timeout() -> float:
|
2023-08-31 11:48:59 +03:00
|
|
|
return deadline - asyncio.get_running_loop().time()
|
|
|
|
|
|
|
|
sender, enqueuer = await asyncio.wait_for(
|
|
|
|
connect(Full(), TELEGRAM_DEFAULT_TEST_DC), timeout()
|
|
|
|
)
|
|
|
|
|
|
|
|
# TODO test enqueuer
|
|
|
|
sender, enqueuer
|
|
|
|
|
|
|
|
asyncio.run(func())
|