Skip to content

Commit 4ef565a

Browse files
Michael Brewerheitorlessa
Michael Brewer
andauthored
test(general): Add some missing code coverage (#296)
* tests: Add some missing code coverage * test(DictWrapper): Add check for not isinstance * test(tracing): Add mock to test aiohttp_trace_config * test(appconfig): Add test for get_app_config() without a default provider * chore: Bump CI * doc: correct docs Co-authored-by: Heitor Lessa <[email protected]> * chore: formatting * tests: Assert that the TraceConfig has been configured * tests: removed Co-authored-by: Heitor Lessa <[email protected]>
1 parent 6e293b1 commit 4ef565a

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tests/functional/test_lambda_trigger_events.py

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ def message(self) -> str:
5454

5555
assert DataClassSample(data1) == DataClassSample(data1)
5656
assert DataClassSample(data1) != DataClassSample(data2)
57+
# Comparing against a dict should not be equals
58+
assert DataClassSample(data1) != data1
59+
assert data1 != DataClassSample(data1)
5760
assert DataClassSample(data1) is not data1
5861
assert data1 is not DataClassSample(data1)
5962

tests/functional/test_utilities_parameters.py

+26
Original file line numberDiff line numberDiff line change
@@ -1534,6 +1534,32 @@ def _get_multiple(self, path: str, **kwargs) -> Dict[str, str]:
15341534
assert str_value == json.dumps(mock_body_json)
15351535

15361536

1537+
def test_appconf_get_app_config_new(monkeypatch, mock_name, mock_value):
1538+
# GIVEN
1539+
class TestProvider(BaseProvider):
1540+
def __init__(self, environment: str, application: str):
1541+
super().__init__()
1542+
1543+
def get(self, name: str, **kwargs) -> str:
1544+
return mock_value
1545+
1546+
def _get(self, name: str, **kwargs) -> str:
1547+
raise NotImplementedError()
1548+
1549+
def _get_multiple(self, path: str, **kwargs) -> Dict[str, str]:
1550+
raise NotImplementedError()
1551+
1552+
monkeypatch.setattr(parameters.appconfig, "DEFAULT_PROVIDERS", {})
1553+
monkeypatch.setattr(parameters.appconfig, "AppConfigProvider", TestProvider)
1554+
1555+
# WHEN
1556+
value = parameters.get_app_config(mock_name, environment="dev", application="myapp")
1557+
1558+
# THEN
1559+
assert parameters.appconfig.DEFAULT_PROVIDERS["appconfig"] is not None
1560+
assert value == mock_value
1561+
1562+
15371563
def test_transform_value_json(mock_value):
15381564
"""
15391565
Test transform_value() with a json transform

0 commit comments

Comments
 (0)