async def test_register_graphql_engine(): app_mock = {} graphql_engine_mock = Mock() graphql_engine_mock.cook = CoroutineMock() with patch.object( graphql_engine, "_GRAPHQL_ENGINE", new=graphql_engine_mock ): assert "graphql_engine" not in app_mock await register_graphql_engine(app_mock) assert app_mock["graphql_engine"] is graphql_engine_mock graphql_engine_mock.cook.assert_awaited_once()