Add stream_content to BaseSession and add tests

This commit is contained in:
gabbhack 2020-01-22 22:54:29 +05:00
parent 213f2a3c16
commit 7ab0db7991
3 changed files with 33 additions and 3 deletions

View file

@ -1,5 +1,5 @@
from collections import deque
from typing import TYPE_CHECKING, Deque, Optional, Type
from typing import TYPE_CHECKING, AsyncGenerator, Deque, Optional, Type
from aiogram import Bot
from aiogram.api.client.session.base import BaseSession
@ -29,6 +29,11 @@ class MockedSession(BaseSession):
self.raise_for_status(response)
return response.result # type: ignore
async def stream_content(
self, url: str, timeout: int, chunk_size: int
) -> AsyncGenerator[bytes, None]: # pragma: no cover
yield b""
class MockedBot(Bot):
if TYPE_CHECKING: