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