Skip to content

Commit

Permalink
Merge branch 'qa' into production
Browse files Browse the repository at this point in the history
  • Loading branch information
sarangj committed Mar 14, 2024
2 parents 1587186 + 5b07f83 commit 07eb89e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## v1.1.4 3/14/24
- Fix bug with oauth2 requests after token refresh

## v1.1.3 11/9/23
- Finalize retry logic in Oauth2 Client

Expand All @@ -12,7 +15,7 @@
> Host: ilsstaff.nypl.org
> User-Agent: curl/7.64.1
> Accept: */*
>
>
```
- Due to an accidental deployment, v1.1.0 and v1.1.1 were both released but are identical

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "nypl_py_utils"
version = "1.1.3"
version = "1.1.4"
authors = [
{ name="Aaron Friedman", email="[email protected]" },
]
Expand Down
2 changes: 1 addition & 1 deletion src/nypl_py_utils/classes/oauth2_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _do_http_method(self, method, request_path, **kwargs):
from None

self._generate_access_token()
return self._do_http_method(method, request_path, **kwargs).json()
return self._do_http_method(method, request_path, **kwargs)

def _create_oauth_client(self):
"""
Expand Down
7 changes: 5 additions & 2 deletions tests/test_oauth2_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import json
import pytest
from requests_oauthlib import OAuth2Session
from requests import HTTPError, JSONDecodeError
from requests import HTTPError, JSONDecodeError, Response

from nypl_py_utils.classes.oauth2_api_client import (Oauth2ApiClient,
Oauth2ApiClientError)
Expand Down Expand Up @@ -120,7 +120,10 @@ def test_token_expiration(self, requests_mock, test_instance,
.post(TOKEN_URL, text=json.dumps(second_token_response))

# Perform second request:
test_instance._do_http_method('GET', 'foo')
response = test_instance._do_http_method('GET', 'foo')
# Ensure we still return a plain requests Response object
assert isinstance(response, Response)
assert response.json() == {"foo": "bar"}
# Expect a call on the second token server:
assert len(second_token_server_post.request_history) == 1
# Expect the second GET request to carry the new Bearer token:
Expand Down

0 comments on commit 07eb89e

Please sign in to comment.