Skip to content

Commit

Permalink
Merge pull request #88 from mraniki/dev
Browse files Browse the repository at this point in the history
👷 CI Change
  • Loading branch information
mraniki authored Oct 17, 2023
2 parents 2d456e4 + d6f77b1 commit f691313
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiodns==3.1.0 ; python_version >= "3.10" and python_version < "4.0"
aiodns==3.1.1 ; python_version >= "3.10" and python_version < "4.0"
aiohttp==3.8.6 ; python_version >= "3.10" and python_version < "4.0"
aiosignal==1.3.1 ; python_version >= "3.10" and python_version < "4.0"
async-timeout==4.0.3 ; python_version >= "3.10" and python_version < "4.0"
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ testpaths = "tests"
python_classes = "Test*"
log_format = "%(asctime)s - %(levelname)s - %(name)s - %(message)s"
log_level = "DEBUG"
addopts = """
-v
--show-capture=stderr
"""

[tool.coverage.run]
omit = [
Expand Down
39 changes: 14 additions & 25 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,12 @@ def test_dynaconf_is_in_testing_env_CEX():
print(settings.VALUE)
assert settings.VALUE == "On Testing CEX"


# @pytest.mark.asyncio
# async def test_cefi_exception():
# with pytest.raises(Exception):
# return CexTrader("123")


@pytest.mark.asyncio
async def test_cefi(CXTrader):
Expand Down Expand Up @@ -111,12 +112,14 @@ async def test_submit_order(CXTrader, order):
assert "huobi" in result[1]
assert ("🔵" in result[1]) or ("Error" in result[1])


@pytest.mark.asyncio
async def test_submit_order_exception(CXTrader):
with pytest.raises(Exception):
CXTrader.clients=[]
CXTrader.clients = []
await CXTrader.submit_order()



# @pytest.mark.asyncio
# async def test_submit_limit_order(CXTrader, limit_order):
# result = await CXTrader.submit_order(limit_order)
Expand All @@ -126,33 +129,19 @@ async def test_submit_order_exception(CXTrader):
# assert "🔵" in result or ("Error" in result)



@pytest.mark.asyncio
async def test_get_trade_confirmation(CXTrader):
# Create a mock trade object and test different cases
trade_buy = {
'amount': 10.0,
'price': 100.0,
'takeProfitPrice': 110.0,
'stopLossPrice': 90.0,
'id': '12345',
'datetime': '2023-10-07 12:00:00'
}

trade_sell = {
'amount': 10.0,
'price': 100.0,
'takeProfitPrice': 110.0,
'stopLossPrice': 90.0,
'id': '67890',
'datetime': '2023-10-07 14:00:00'
trade = {
"amount": 10.0,
"price": 100.0,
"takeProfitPrice": 110.0,
"stopLossPrice": 90.0,
"id": "67890",
"datetime": "2023-10-07 14:00:00",
}

for client in CXTrader.clients:
result = await client.get_trade_confirmation(
trade_sell,
"InstrumentName",
"SELL")
result = await client.get_trade_confirmation(trade, "InstrumentName", "SELL")
assert ("binance" in result) or ("huobi" in result)
assert "⬇️" in result
assert "⚫" in result
Expand Down

0 comments on commit f691313

Please sign in to comment.