Skip to content

Commit 4c82ae1

Browse files
committed
Minor syntax updates
1 parent e76724f commit 4c82ae1

4 files changed

Lines changed: 11 additions & 16 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ kinesis_client = KinesisClient(...)
3838
# Do not use any version below 1.0.0
3939
# All available optional dependencies can be found in pyproject.toml.
4040
# See the "Managing dependencies" section below for more details.
41-
nypl-py-utils[kinesis-client,config-helper]==1.4.0
41+
nypl-py-utils[kinesis-client,config-helper]==1.5.0
4242
```
4343

4444
## Developing locally
@@ -64,7 +64,7 @@ The optional dependency sets also give the developer the option to manually list
6464
### Using PostgreSQLClient in an AWS Lambda
6565
Because `psycopg` requires a statically linked version of the `libpq` library, the `PostgreSQLClient` cannot be installed as-is in an AWS Lambda function. Instead, it must be packaged as follows:
6666
```bash
67-
pip install --target ./package nypl-py-utils[postgresql-client]==1.4.0
67+
pip install --target ./package nypl-py-utils[postgresql-client]==1.5.0
6868

6969
pip install \
7070
--platform manylinux2014_x86_64 \

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
44

55
[project]
66
name = "nypl_py_utils"
7-
version = "1.4.0"
7+
version = "1.5.0"
88
authors = [
99
{ name="Aaron Friedman", email="aaronfriedman@nypl.org" },
1010
]

src/nypl_py_utils/classes/cloudlibrary_client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ def request(self, path, method_type="GET",
7979
Use this method to call specific paths in the cloudLibrary API.
8080
This method is necessary for building headers/authorization.
8181
Example usage of this method is in the get_library_events function.
82+
83+
Returns Response object by default -- you will need to parse the object
84+
to retrieve text, status code, etc.
8285
"""
8386
extended_path = f"/cirrus/library/{self.library_id}/{path}"
8487
headers = self._build_headers(method_type, extended_path)

tests/test_cloudlibrary_client.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def test_instance(self):
4040
"library_id", "account_id", "account_key")
4141

4242
def test_get_library_events_success_no_args(
43-
self, test_instance, mocker, caplog):
43+
self, test_instance, mocker):
4444
start = "2024-11-10T10:00:00"
4545
end = "2024-11-11T10:00:00"
4646
mock_request = mocker.patch(
@@ -52,11 +52,9 @@ def test_get_library_events_success_no_args(
5252
path=f"data/cloudevents?startdate={start}&enddate={end}",
5353
method_type="GET")
5454
assert response == _TEST_LIBRARY_EVENTS_RESPONSE
55-
assert (f"Fetching all library events in time frame "
56-
f"{start} to {end}...") in caplog.text
5755

5856
def test_get_library_events_success_with_start_and_end_date(
59-
self, test_instance, mocker, caplog):
57+
self, test_instance, mocker):
6058
start = "2024-11-01T10:00:00"
6159
end = "2024-11-05T10:00:00"
6260
mock_request = mocker.patch(
@@ -68,11 +66,9 @@ def test_get_library_events_success_with_start_and_end_date(
6866
path=f"data/cloudevents?startdate={start}&enddate={end}",
6967
method_type="GET")
7068
assert response == _TEST_LIBRARY_EVENTS_RESPONSE
71-
assert (f"Fetching all library events in time frame "
72-
f"{start} to {end}...") in caplog.text
7369

7470
def test_get_library_events_success_with_no_end_date(
75-
self, test_instance, mocker, caplog):
71+
self, test_instance, mocker):
7672
start = "2024-11-01T09:00:00"
7773
end = "2024-11-11T10:00:00"
7874
mock_request = mocker.patch(
@@ -84,18 +80,14 @@ def test_get_library_events_success_with_no_end_date(
8480
path=f"data/cloudevents?startdate={start}&enddate={end}",
8581
method_type="GET")
8682
assert response == _TEST_LIBRARY_EVENTS_RESPONSE
87-
assert (f"Fetching all library events in time frame "
88-
f"{start} to {end}...") in caplog.text
8983

9084
def test_get_library_events_exception_when_start_date_greater_than_end(
91-
self, test_instance, caplog):
85+
self, test_instance):
9286
start = "2024-11-11T09:00:00"
9387
end = "2024-11-01T10:00:00"
9488

9589
with pytest.raises(CloudLibraryClientError):
9690
test_instance.get_library_events(start, end)
97-
assert (f"Start date {start} greater than end date "
98-
f"{end}, cannot retrieve library events") in caplog.text
9991

10092
def test_get_library_events_exception_when_connection_timeout(
10193
self, test_instance, requests_mock):
@@ -129,7 +121,7 @@ def test_request_success(self, test_instance, mocker):
129121
headers=expected_headers,
130122
timeout=60)
131123

132-
def test_request_failure(self, test_instance, requests_mock, caplog):
124+
def test_request_failure(self, test_instance, requests_mock):
133125
start = "2024-11-10T10:00:00"
134126
end = "2024-11-11T10:00:00"
135127
requests_mock.get(

0 commit comments

Comments
 (0)