(
self,
async_method_mocker: AsyncMethodMocker,
test_app_client: httpx.AsyncClient,
oauth_client: BaseOAuth2,
user_oauth: UserOAuthModel,
access_token: str,
)
| 144 | ) |
| 145 | class TestCallback: |
| 146 | async def test_invalid_state( |
| 147 | self, |
| 148 | async_method_mocker: AsyncMethodMocker, |
| 149 | test_app_client: httpx.AsyncClient, |
| 150 | oauth_client: BaseOAuth2, |
| 151 | user_oauth: UserOAuthModel, |
| 152 | access_token: str, |
| 153 | ): |
| 154 | async_method_mocker(oauth_client, "get_access_token", return_value=access_token) |
| 155 | get_id_email_mock = async_method_mocker( |
| 156 | oauth_client, "get_id_email", return_value=("user_oauth1", user_oauth.email) |
| 157 | ) |
| 158 | |
| 159 | response = await test_app_client.get( |
| 160 | "/oauth/callback", |
| 161 | params={"code": "CODE", "state": "STATE"}, |
| 162 | ) |
| 163 | assert response.status_code == status.HTTP_400_BAD_REQUEST |
| 164 | |
| 165 | get_id_email_mock.assert_not_called() |
| 166 | |
| 167 | @pytest.mark.parametrize("csrf_token", [None, "invalid_csrf_token"]) |
| 168 | async def test_invalid_csrf_state( |
nothing calls this directly
no test coverage detected