(token)
| 171 | |
| 172 | |
| 173 | def test_fetch_token_get(token): |
| 174 | url = "https://provider.test/token" |
| 175 | |
| 176 | def fake_send(r, **kwargs): |
| 177 | assert "code=v" in r.url |
| 178 | assert "grant_type=authorization_code" in r.url |
| 179 | resp = mock.MagicMock() |
| 180 | resp.status_code = 200 |
| 181 | resp.json = lambda: token |
| 182 | return resp |
| 183 | |
| 184 | sess = OAuth2Session(client_id="foo") |
| 185 | sess.send = fake_send |
| 186 | token = sess.fetch_token( |
| 187 | url, authorization_response="https://provider.test/?code=v", method="GET" |
| 188 | ) |
| 189 | assert token == token |
| 190 | |
| 191 | sess = OAuth2Session( |
| 192 | client_id="foo", |
| 193 | token_endpoint_auth_method="none", |
| 194 | ) |
| 195 | sess.send = fake_send |
| 196 | token = sess.fetch_token(url, code="v", method="GET") |
| 197 | assert token == token |
| 198 | |
| 199 | token = sess.fetch_token(url + "?q=a", code="v", method="GET") |
| 200 | assert token == token |
| 201 | |
| 202 | |
| 203 | def test_token_auth_method_client_secret_post(token): |
nothing calls this directly
no test coverage detected
searching dependent graphs…