-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb9ea85
commit 4eae4e5
Showing
6 changed files
with
26 additions
and
18 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,10 @@ | ||
import asyncio | ||
from datetime import datetime as dt | ||
from datetime import timedelta | ||
|
||
import pytest | ||
|
||
from app.client.deribit import CURRENCIES, get_data_from_tickers | ||
from tests.conftest import CURRENCIES, get_data_from_tickers | ||
from tests.utils import check_currency | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_get_data_from_tickers(event_loop): | ||
assert event_loop is asyncio.get_running_loop() | ||
# assert asyncio.iscoroutine(get_data_from_tickers) | ||
seconds = 10 | ||
data = await get_data_from_tickers() | ||
for name, price, timestamp in data[0]: | ||
assert name in CURRENCIES | ||
assert isinstance(price, float) | ||
assert isinstance(timestamp, int) | ||
res = ((dt.now() - timedelta(seconds=seconds)).timestamp() < | ||
timestamp < | ||
(dt.now() + timedelta(seconds=seconds)).timestamp()) | ||
assert res | ||
for currency in await get_data_from_tickers(): | ||
check_currency(*currency, CURRENCIES) |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
from celery.local import PromiseProxy | ||
|
||
from app.celery_tasks.tasks import synchronize | ||
from tests.conftest import CURRENCIES | ||
from tests.utils import check_currency | ||
|
||
|
||
def test_task(): | ||
assert isinstance(synchronize, PromiseProxy), type(synchronize) | ||
assert synchronize.name == 'app.celery_tasks.tasks.synchronize' | ||
currencies = synchronize() | ||
for currency in currencies: | ||
check_currency(*currency, CURRENCIES) |
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