MCPcopy Create free account
hub / github.com/fastapi-users/fastapi-users / async_method_mocker

Function async_method_mocker

tests/conftest.py:126–143  ·  view source on GitHub ↗
(mocker: MockerFixture)

Source from the content-addressed store, hash-verified

124
125@pytest.fixture
126def async_method_mocker(mocker: MockerFixture) -> AsyncMethodMocker:
127 def _async_method_mocker(
128 object: Any,
129 method: str,
130 return_value: Any = None,
131 ) -> MagicMock:
132 mock: MagicMock = mocker.MagicMock()
133
134 future: asyncio.Future = asyncio.Future()
135 future.set_result(return_value)
136 mock.return_value = future
137 mock.side_effect = None
138
139 setattr(object, method, mock)
140
141 return mock
142
143 return _async_method_mocker
144
145
146@pytest.fixture(params=[JWT_SECRET, SecretStr(JWT_SECRET)])

Callers 15

test_user_inactiveMethod · 0.85
test_successMethod · 0.85
test_successMethod · 0.85
test_invalid_stateMethod · 0.85
test_active_userMethod · 0.85
test_inactive_userMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…