Esempio n. 1
0
async def test_streaming_server_time_in_handler():
    def func(api, payload, server_time):
        pass

    Streaming('TOKEN').add_handlers([('some_event', func)])

    assert func.receive_server_time__  # pylint:disable=no-member
Esempio n. 2
0
async def streaming(token, session):
    return Streaming(token, session=session, reconnect_enabled=False)
Esempio n. 3
0
async def test_closed_session(token, closed_session):
    async with Streaming(token, session=closed_session):
        pass
Esempio n. 4
0
async def streaming(token, streaming_events):
    s = Streaming(token).add_handlers(streaming_events)
    yield s
    await s._session.close()
Esempio n. 5
0
def test_streaming_without_token():
    with pytest.raises(ValueError):
        Streaming('')
Esempio n. 6
0
async def streaming(token, streaming_events, session):
    return Streaming(token, session=session).add_handlers(streaming_events)
Esempio n. 7
0
async def test_streaming_without_token():
    with pytest.raises(ValueError, match='^Token can not be empty$'):
        Streaming('')