@@ -82,26 +82,29 @@ def test_get_library_events_success_with_no_end_date(
8282 assert response == _TEST_LIBRARY_EVENTS_RESPONSE
8383
8484 def test_get_library_events_exception_when_start_date_greater_than_end (
85- self , test_instance ):
85+ self , test_instance , caplog ):
8686 start = "2024-11-11T09:00:00"
8787 end = "2024-11-01T10:00:00"
8888
8989 with pytest .raises (CloudLibraryClientError ):
9090 test_instance .get_library_events (start , end )
91+ assert (f"Start date { start } greater than end date { end } , "
92+ f"cannot retrieve library events" ) in caplog .text
9193
9294 def test_get_library_events_exception_when_connection_timeout (
93- self , test_instance , requests_mock ):
95+ self , test_instance , requests_mock , caplog ):
9496 start = "2024-11-10T10:00:00"
9597 end = "2024-11-11T10:00:00"
98+ url = f"{ _API_URL } { test_instance .library_id } /data/cloudevents?startdate={ start } &enddate={ end } " # noqa
9699
97100 # We're making sure that a separate error during a sub-method will
98101 # still result in CloudLibraryClientError
99102 requests_mock .get (
100- f"{ _API_URL } { test_instance .library_id } /data/cloudevents?startdate={ start } &enddate={ end } " , # noqa
101- exc = ConnectTimeout )
103+ url , exc = ConnectTimeout )
102104
103105 with pytest .raises (CloudLibraryClientError ):
104106 test_instance .get_library_events ()
107+ assert (f"Failed to retrieve response from { url } " ) in caplog .text
105108
106109 def test_get_request_success (self , test_instance , requests_mock ):
107110 start = "2024-11-10T10:00:00"
@@ -171,17 +174,20 @@ def test_post_request_success(self, test_instance, requests_mock):
171174 assert expected_headers .items () <= dict (
172175 requests_mock .request_history [0 ].headers ).items ()
173176
174- def test_request_failure (self , test_instance , requests_mock ):
177+ def test_request_failure (self , test_instance ,
178+ requests_mock , caplog ):
175179 start = "2024-11-10T10:00:00"
176180 end = "2024-11-11T10:00:00"
181+ url = f"{ _API_URL } { test_instance .library_id } /data/cloudevents?startdate={ start } &enddate={ end } " # noqa
177182 requests_mock .get (
178- f"{ _API_URL } { test_instance .library_id } /data/cloudevents?startdate={ start } &enddate={ end } " , # noqa
179- exc = ConnectTimeout )
183+ url , exc = ConnectTimeout )
180184
181185 with pytest .raises (CloudLibraryClientError ):
182186 test_instance .request (
183187 path = f"data/cloudevents?startdate={ start } &enddate={ end } " ,
184188 method_type = "GET" )
189+ assert (f"Failed to retrieve response from "
190+ f"{ url } : ConnectTimeout()" ) in caplog .text
185191
186192 def test_create_request_body_success (self , test_instance ):
187193 request_type = "CheckoutRequest"
0 commit comments