Skip to content

Commit

Permalink
All tests for public endpoints added
Browse files Browse the repository at this point in the history
  • Loading branch information
yzh-pelle committed Dec 5, 2024
1 parent c4ccd43 commit 98223a7
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions tests/test_public_endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,17 @@ async def test_fiat_prices_async(asyncClient):
response = await asyncClient.get_fiat_prices(None, code)
assert code in response

def test_futures_symbol(client):
response = client.futures_get_symbol("ETHUSDTM")
symbol = response["symbol"]
assert symbol == "ETHUSDTM"

@pytest.mark.asyncio()
async def test_futures_symbol_async(asyncClient):
response = await asyncClient.futures_get_symbol("ETHUSDTM")
symbol = response["symbol"]
assert symbol == "ETHUSDTM"

def test_futures_symbols(client):
response = client.futures_get_symbols()
assert response is not None
Expand Down Expand Up @@ -226,9 +237,9 @@ def test_futures_interest_rate(client):
# response = await asyncClient.futures_get_interest_rate(".KXBT")
# assert response is not None

# def test_futures_index(client):
# response = client.futures_get_index(".KXBT")
# assert response is not None
def test_futures_index(client):
response = client.futures_get_index(".KXBT")
assert response is not None

# todo:
# File "/opt/homebrew/lib/python3.11/site-packages/yarl/_url.py", line 946, in _query_var
Expand All @@ -248,4 +259,33 @@ def test_futures_mark_price(client):
async def test_futures_mark_price_async(asyncClient):
response = await asyncClient.futures_get_mark_price("ETHUSDTM")
symbol = response["symbol"]
assert symbol == "ETHUSDTM"
assert symbol == "ETHUSDTM"

def test_futures_premium_index(client):
response = client.futures_get_premium_index("ETHUSDTM")
assert response is not None

# todo:
# TypeError: Invalid variable type: value should be str, int or float, got True of type <class 'bool'>
# @pytest.mark.asyncio()
# async def test_futures_premium_index_async(asyncClient):
# response = await asyncClient.futures_get_premium_index("ETHUSDTM")
# assert response is not None

def test_margin_all_trading_pairs_mark_prices(client):
response = client.margin_get_all_trading_pairs_mark_prices()
assert response is not None

@pytest.mark.asyncio()
def test_margin_all_trading_pairs_mark_prices_async(asyncClient):
response = asyncClient.margin_get_all_trading_pairs_mark_prices()
assert response is not None

def test_futures_public_funding_history(client):
response = client.futures_get_public_funding_history('ETHUSDTM', start=1622505600000, end=1622592000000)
assert response is not None

@pytest.mark.asyncio()
async def test_futures_public_funding_history_async(asyncClient):
response = await asyncClient.futures_get_public_funding_history('ETHUSDTM', start=1622505600000, end=1622592000000)
assert response is not None

0 comments on commit 98223a7

Please sign in to comment.