Created
November 9, 2017 17:38
-
-
Save mrzechonek/df22ad89e72ebadb41cab0e0f8893a09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.asyncio | |
@pytest.mark.django_db | |
async def test_request(zmq_client, feed_task, test_month): | |
stocks, sessions, quotes = test_month | |
subscription = zmq_client.subscribe('quotes', 'quote') | |
reply, count = await zmq_client._async(feed_task.request, | |
start=datetime(2017, 1, 1), | |
end=datetime(2017, 1, 3)) | |
assert reply | |
assert count == 2 | |
for date in (datetime(2017, 1, 1), datetime(2017, 1, 2)): | |
*_, feed = await asyncio.wait_for(pop(subscription, schema=FeedSchema()), timeout=1.0) | |
assert feed.session.date == date.date() | |
assert set(feed.stock_data.keys()) == set(s.id for s in stocks.values()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment