Skip to content

Commit a69b96e

Browse files
committed
LCORE-602: Fix unit-test warning
``` .../assisted-chat/lightspeed-stack/src/authorization/middleware.py:91: RuntimeWarning: coroutine 'AsyncMockMixin._execute_mock_call' was never awaited if not access_resolver.check_access(action, user_roles): Enable tracemalloc to get traceback where the object was allocated. See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info. ``` `mock_access_resolver` is created as an `AsyncMock`, which makes all its methods async by default, but `AccessResolver` `check_access` is sync
1 parent 690a6bc commit a69b96e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/unit/utils/auth_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def mock_authorization_resolvers(mocker: Any) -> None:
1919
"authorization.middleware.get_authorization_resolvers"
2020
)
2121
mock_role_resolver = AsyncMock()
22-
mock_access_resolver = AsyncMock()
22+
mock_access_resolver = Mock()
2323
mock_role_resolver.resolve_roles.return_value = set()
2424
mock_access_resolver.check_access.return_value = True
2525
# get_actions should be synchronous, not async

0 commit comments

Comments
 (0)