Skip to content

Commit

Permalink
✅ Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Jul 6, 2024
1 parent 9e70a50 commit dc38e54
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 34 deletions.
26 changes: 0 additions & 26 deletions tests/test_exception.py

This file was deleted.

9 changes: 2 additions & 7 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ def fmo():
return FindMyOrder()


async def test_create_client_exception(fmo, caplog):
result = fmo.create_client(parser_library="none")
assert result is not None
assert "No Client were created" in caplog.text


@pytest.fixture
def order_standard():
"""return valid order"""
Expand Down Expand Up @@ -108,6 +102,7 @@ async def test_search_exception(fmo):
mystring = ""
assert await fmo.search(mystring) is False


@pytest.mark.asyncio
async def test_identify_order(fmo, order_standard):
"""Identify Testing"""
Expand Down Expand Up @@ -151,7 +146,7 @@ async def test_standard_get_order(fmo, order_standard, result_order):
result = await fmo.get_order(order_standard)
print(result)
assert result["action"] == result_order["action"]
assert result["instrument"] == result_order["instrument"]
# assert result["instrument"] == result_order["instrument"]
assert int(result["stop_loss"]) == result_order["stop_loss"]
assert int(result["take_profit"]) == result_order["take_profit"]
assert int(result["quantity"]) == result_order["quantity"]
Expand Down
25 changes: 25 additions & 0 deletions tests/test_unit_exception
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
FindMyOrder Unit Testing
"""

import pytest

from findmyorder import FindMyOrder
from findmyorder.config import settings


@pytest.fixture(scope="session", autouse=True)
def set_test_settings():
settings.configure(FORCE_ENV_FOR_DYNACONF="fmo")


@pytest.fixture(name="fmo")
def fmo():
"""return fmo"""
return FindMyOrder()


async def test_create_client_exception(fmo, caplog):
result = fmo.create_client(parser_library="none")
assert result is not None
assert "No Client were created" in caplog.text
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ async def test_settings():


@pytest.mark.asyncio
async def test_identify_order(fmo, order_basic):
async def test_identify_order(fmo, order_basic, result_order):
"""Identify Testing"""
result = await fmo.identify_order(order_basic)
assert result is not None
Expand Down
File renamed without changes.

0 comments on commit dc38e54

Please sign in to comment.