-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,7 @@ addopts = """ | |
-v | ||
--show-capture=stderr | ||
""" | ||
asyncio_mode = "auto" | ||
|
||
[tool.coverage.run] | ||
omit = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
FindMyOrder Exception Testing | ||
""" | ||
|
||
import pytest | ||
|
||
from iamlistening import Listener | ||
from iamlistening.config import settings | ||
|
||
|
||
@pytest.fixture(scope="session", autouse=True) | ||
def set_test_settings(): | ||
settings.configure(FORCE_ENV_FOR_DYNACONF="exception") | ||
|
||
|
||
@pytest.mark.asyncio | ||
async def test_module_exception(caplog): | ||
result = Listener() | ||
print(result) | ||
assert any( | ||
record.message == "Module is disabled. No Client will be created." | ||
for record in caplog.records | ||
if record.levelname == "INFO" | ||
) | ||
|
||
|
||
# @pytest.mark.asyncio | ||
async def test_create_client_exception(caplog): | ||
settings.iamlistening_enabled = True | ||
test_class = Listener() | ||
result = test_class._create_client() | ||
print(result) | ||
assert result is not None | ||
assert any( | ||
record.message | ||
== "No Client were created. Check your settings or disable the module." | ||
for record in caplog.records | ||
if record.levelname == "WARNING" | ||
) |