|
19 | 19 | from requests_oauthlib.compliance_fixes import slack_compliance_fix |
20 | 20 | from requests_oauthlib.compliance_fixes import instagram_compliance_fix |
21 | 21 | from requests_oauthlib.compliance_fixes import plentymarkets_compliance_fix |
| 22 | +from requests_oauthlib.compliance_fixes import ebay_compliance_fix |
22 | 23 |
|
23 | 24 |
|
24 | 25 | class FacebookComplianceFixTest(TestCase): |
@@ -305,3 +306,29 @@ def test_fetch_access_token(self): |
305 | 306 | "refresh_token": "iG2kBGIjcXaRE4xmTVUnv7xwxX7XMcWCHqJmFaSX", |
306 | 307 | }, |
307 | 308 | ) |
| 309 | + |
| 310 | + |
| 311 | +class EbayComplianceFixTest(TestCase): |
| 312 | + def setUp(self): |
| 313 | + mocker = requests_mock.Mocker() |
| 314 | + mocker.post( |
| 315 | + "https://api.ebay.com/identity/v1/oauth2/token", |
| 316 | + json={ |
| 317 | + "access_token": "this is the access token", |
| 318 | + "expires_in": 7200, |
| 319 | + "token_type": "Application Access Token", |
| 320 | + }, |
| 321 | + headers={"Content-Type": "application/json"}, |
| 322 | + ) |
| 323 | + mocker.start() |
| 324 | + self.addCleanup(mocker.stop) |
| 325 | + |
| 326 | + session = OAuth2Session() |
| 327 | + self.fixed_session = ebay_compliance_fix(session) |
| 328 | + |
| 329 | + def test_fetch_access_token(self): |
| 330 | + token = self.fixed_session.fetch_token( |
| 331 | + "https://api.ebay.com/identity/v1/oauth2/token", |
| 332 | + authorization_response="https://i.b/?code=hello", |
| 333 | + ) |
| 334 | + assert token["token_type"] == "Bearer" |
0 commit comments