Skip to content

Commit

Permalink
✅ Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Jul 3, 2024
1 parent 9ee5519 commit 604c3a1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
41 changes: 7 additions & 34 deletions findmyorder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,39 +159,9 @@ async def search(self, message: str) -> bool:
"""
for client in self.clients:
yield await client.search()

async def identify_order(
self,
my_string: str,
) -> dict:
"""
Identify an order and return a dictionary
with the order parameters
Args:
my_string (str): Message
Returns:
dict
"""
for client in self.clients:
yield client.identify_order()

async def replace_instrument(self, order):
"""
Replace instrument by an alternative instrument, if the
instrument is not in the mapping, it will be ignored.
Args:
order (dict):
Returns:
dict
"""
for client in self.clients:
yield client.replace_instrument()
if await client.search(message):
return True
return False

async def get_order(
self,
Expand All @@ -208,5 +178,8 @@ async def get_order(
dict
"""
results = []
for client in self.clients:
yield await client.get_order()
result = await client.get_order(msg)
results.append(result)
return results
3 changes: 1 addition & 2 deletions tests/test_unit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def set_test_settings():
settings.configure(FORCE_ENV_FOR_DYNACONF="fmo")



@pytest.fixture(name="fmo")
def fmo():
"""return fmo"""
Expand Down Expand Up @@ -139,7 +138,7 @@ async def test_info(fmo):
result = await fmo.get_info()
print(result)
assert result is not None
assert str(result).startswith("FindMyOrder")
assert "FindMyOrder" in result


@pytest.mark.asyncio
Expand Down

0 comments on commit 604c3a1

Please sign in to comment.