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

Method test_success

tests/test_router_oauth.py:90–110  ·  view source on GitHub ↗
(
        self,
        async_method_mocker: AsyncMethodMocker,
        test_app_client: httpx.AsyncClient,
        oauth_client: BaseOAuth2,
    )

Source from the content-addressed store, hash-verified

88@pytest.mark.asyncio
89class TestAuthorize:
90 async def test_success(
91 self,
92 async_method_mocker: AsyncMethodMocker,
93 test_app_client: httpx.AsyncClient,
94 oauth_client: BaseOAuth2,
95 ):
96 get_authorization_url_mock = async_method_mocker(
97 oauth_client, "get_authorization_url", return_value="AUTHORIZATION_URL"
98 )
99
100 response = await test_app_client.get(
101 "/oauth/authorize", params={"scopes": ["scope1", "scope2"]}
102 )
103
104 assert response.status_code == status.HTTP_200_OK
105 get_authorization_url_mock.assert_called_once()
106
107 data = response.json()
108 assert "authorization_url" in data
109
110 assert response.cookies.get("fastapiusersoauthcsrf") is not None
111
112 async def test_with_redirect_url(
113 self,

Callers

nothing calls this directly

Calls 2

async_method_mockerFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected