Skip to content

Commit

Permalink
updated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alb2001 committed Dec 15, 2023
1 parent f930e83 commit dd94967
Showing 1 changed file with 22 additions and 7 deletions.
29 changes: 22 additions & 7 deletions tests/test_dextools_api_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,26 +230,41 @@ def test_get_token_pools_sorted_by_creationBlock(dextools_instance):
assert isinstance(response["data"], dict)
assert isinstance(response["data"]["results"], list)

def get_ranking_hotpools(dextools_instance):
def test_get_ranking_hotpools(dextools_instance):
chain = "ether"
response = dextools_instance.get_ranking_hotpools(dextools_instance)
response = dextools_instance.get_ranking_hotpools(chain)

assert response["statusCode"] == 200
assert isinstance(response, dict)
assert isinstance(response["data"], list)

def get_ranking_gainers(dextools_instance):
def test_get_ranking_gainers(dextools_instance):
chain = "ether"
response = dextools_instance.get_ranking_gainers(dextools_instance)
response = dextools_instance.get_ranking_gainers(chain)

assert response["statusCode"] == 200
assert isinstance(response, dict)
assert isinstance(response["data"], list)

def get_ranking_losers(dextools_instance):
def test_get_ranking_losers(dextools_instance):
chain = "ether"
response = dextools_instance.get_ranking_losers(dextools_instance)
response = dextools_instance.get_ranking_losers(chain)

assert response["statusCode"] == 200
assert isinstance(response, dict)
assert isinstance(response["data"], list)
assert isinstance(response["data"], list)

def test_plans(dextools_instance):
plans = ["free", "standard", "advanced", "pro"]
for plan in plans:
dextools_instance.set_plan(plan)
assert dextools_instance.url == f"https://open-api.dextools.io/{plan}"
assert dextools_instance._headers.get("X-BLOBR-KEY") == API_KEY

dextools_instance.set_plan("partner")
assert dextools_instance.url == f"https://api.dextools.io/v2"
assert dextools_instance._headers.get("X-API-Key") == API_KEY

with pytest.raises(Exception) as excinfo:
dextools_instance.set_plan("Invalid plan")
assert str(excinfo.value) == "Plan not found"

0 comments on commit dd94967

Please sign in to comment.