1
0
fin-depo/test/test_kucoin.py
Jon Michael Aanes 7c72093893
All checks were successful
Python Ruff Code Quality / ruff (push) Successful in 23s
Run Python tests (through Pytest) / Test (push) Successful in 31s
Verify Python project can be installed, loaded and have version checked / Test (push) Successful in 24s
Code quality
2024-11-28 20:18:33 +01:00

61 lines
1.3 KiB
Python

import datetime
import pytest
import fin_depo
from . import secrets
TEST_MARKET_ORDERS = True
needs_secrets = pytest.mark.skipif(
not secrets.KUCOIN_KEY,
reason='Secret kucoin_USERNAME required',
)
fin_depo.defi_kucoin.logger.setLevel('INFO')
NOW = datetime.datetime.now(tz=datetime.UTC)
def get_fetcher() -> fin_depo.defi_kucoin.KucoinDepoFetcher:
return fin_depo.defi_kucoin.KucoinDepoFetcher(
secrets.KUCOIN_KEY,
secrets.KUCOIN_SECRET,
secrets.KUCOIN_PASS,
)
@needs_secrets
def test_get_depo():
"""Can inspect kucoin depository."""
depo = get_fetcher().get_depo()
assert isinstance(depo, fin_depo.data.DepoGroup)
for nested_depo in depo.nested:
assert isinstance(nested_depo, fin_depo.data.DepoSingle)
@needs_secrets
def test_get_withdrawals():
withdrawals = get_fetcher()._get_withdrawals()
assert len(withdrawals) > 0
@needs_secrets
def test_get_deposits():
deposits = get_fetcher()._get_deposits()
assert len(deposits) > 0
@needs_secrets
def test_get_historic_spot_orders():
orders = get_fetcher()._get_historic_spot_orders()
assert next(orders)
@needs_secrets
def test_get_double_registers():
double_registers = get_fetcher()._get_double_registers()
assert len(double_registers) > 0