Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Aug 9, 2023
1 parent c9ccd16 commit d6e37a7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ def set_test_settings_CEX():
settings.configure(FORCE_ENV_FOR_DYNACONF="testingbinancecex")


@pytest.fixture(name="order_message")
def order():
"""return valid order"""
return "buy BTCUSDT sl=200 tp=400 q=1%"


@pytest.fixture(name="order_parsed")
def result_order():
"""return standard expected results"""
return {
"action": "BUY",
"instrument": "EURUSD",
"instrument": "BTCUSDT",
"stop_loss": 200,
"take_profit": 400,
"quantity": 2,
Expand Down Expand Up @@ -71,7 +65,7 @@ async def test_parse_quote(exchange, caplog):
"""Test parse_message balance"""
result = await exchange.get_quote("BTCUSDT")
assert result is not None
#assert "🏦" in caplog.text
assert "🏦" in caplog.text

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.


@pytest.mark.asyncio
Expand Down Expand Up @@ -124,12 +118,20 @@ async def test_get_help(exchange):
assert "🏦" in result


@pytest.mark.asyncio
async def test_position(exchange, caplog):
"""Test position"""

result = await exchange.get_account_position()
assert result is not None

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

@pytest.mark.asyncio
async def test_execute_order(exchange, order_parsed):
result = await exchange.execute_order(order_parsed)
print(result)
assert result is not None
assert "⚠️ order execution" in result
assert "⬆️" in result

Check notice

Code scanning / Bandit

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
#assert "⚠️ order execution" in result


# @pytest.mark.asyncio
Expand Down

0 comments on commit d6e37a7

Please sign in to comment.