Skip to content

Commit

Permalink
✅ Unit Test
Browse files Browse the repository at this point in the history
  • Loading branch information
mraniki committed Jul 7, 2024
1 parent aa28581 commit fa6a93a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion findmyorder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(

self.enabled = settings.findmyorder_enabled
if not self.enabled:
logger.info("FindMyOrder is disabled. No Parser will be created.")
logger.info("Module is disabled. No Client will be created.")
return
self.client_classes = self.get_all_client_classes()
self.clients = []
Expand Down
14 changes: 4 additions & 10 deletions tests/test_unit_exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,12 @@ def set_test_settings():
settings.configure(FORCE_ENV_FOR_DYNACONF="exception")


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


@pytest.mark.asyncio
async def test_module_exception(fmo, caplog):
async def test_module_exception(caplog):
result = FindMyOrder()
print(result)
assert any(
record.message == "FindMyOrder is disabled. No Parser will be created."
record.message == "Module is disabled. No Client will be created."
for record in caplog.records
if record.levelname == "INFO"
)
Expand All @@ -33,8 +27,8 @@ async def test_module_exception(fmo, caplog):
# @pytest.mark.asyncio
async def test_create_client_exception(caplog):
settings.findmyorder_enabled = True
fmo = FindMyOrder()
result = fmo._create_client()
test_class = FindMyOrder()
result = test_class._create_client()
print(result)
assert result is not None
assert any(
Expand Down

0 comments on commit fa6a93a

Please sign in to comment.