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
async def streaming(token, session): return Streaming(token, session=session, reconnect_enabled=False)
async def test_closed_session(token, closed_session): async with Streaming(token, session=closed_session): pass
async def streaming(token, streaming_events): s = Streaming(token).add_handlers(streaming_events) yield s await s._session.close()
def test_streaming_without_token(): with pytest.raises(ValueError): Streaming('')
async def streaming(token, streaming_events, session): return Streaming(token, session=session).add_handlers(streaming_events)
async def test_streaming_without_token(): with pytest.raises(ValueError, match='^Token can not be empty$'): Streaming('')