Skip to content

Commit

Permalink
add basic smoke tests for the data layer
Browse files Browse the repository at this point in the history
  • Loading branch information
callmephilip committed Oct 30, 2023
1 parent 25c1c87 commit ed672b3
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 6 deletions.
20 changes: 19 additions & 1 deletion poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python-dotenv = "1.0.0"

[tool.poetry.group.dev.dependencies]
pytest = "^7.4.3"
pytest-asyncio = "^0.21.1"

[build-system]
requires = ["poetry-core"]
Expand Down
5 changes: 0 additions & 5 deletions tests/test_common_sense.py

This file was deleted.

20 changes: 20 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import pytest

from dotenv import load_dotenv
load_dotenv(".env.example")

from bots.settings import TOKEN_ADDRESS, STABLE_TOKEN_ADDRESS
from bots.data import Token, Price

@pytest.mark.asyncio
async def test_get_by_token_address():
t = await Token.get_by_token_address(TOKEN_ADDRESS)
assert t.token_address == TOKEN_ADDRESS
assert t.listed == True

@pytest.mark.asyncio
async def test_get_prices():
prices = await Price.get_prices([await Token.get_by_token_address(TOKEN_ADDRESS)])
assert len(prices) == 1
[price] = prices
assert price.pretty_price != 0

0 comments on commit ed672b3

Please sign in to comment.