Skip to content

Commit 2c93a91

Browse files
updated testcase for log msg change
1 parent a9189db commit 2c93a91

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

tests/test_connections.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,14 @@ def test_get_retry_logging(log_stream):
246246
pytest.raises(UnavailableError, conn.make_call, "")
247247
stream.flush()
248248
log = stream.getvalue() # save as a local so can do pytest -l to see exact log
249-
assert log == """UMAPI timeout...service unavailable (code 429 on try 1)
250-
Next retry in 3 seconds...
251-
UMAPI timeout...service unavailable (code 429 on try 2)
252-
Next retry in 3 seconds...
253-
UMAPI timeout...service unavailable (code 429 on try 3)
249+
assert log == """UMAPI request limit reached (code 429 on try 1)
250+
waiting 3 seconds to continue...
251+
UMAPI request limit reached (code 429 on try 2)
252+
waiting 3 seconds to continue...
253+
UMAPI request limit reached (code 429 on try 3)
254254
UMAPI timeout...giving up after 3 attempts (6 seconds).
255255
"""
256256

257-
258257
# log_stream fixture defined in conftest.py
259258
def test_post_retry_logging(log_stream):
260259
with mock.patch("umapi_client.connection.requests.Session.post") as mock_post:
@@ -266,15 +265,14 @@ def test_post_retry_logging(log_stream):
266265
pytest.raises(UnavailableError, conn.make_call, "", [3, 5])
267266
stream.flush()
268267
log = stream.getvalue() # save as a local so can do pytest -l to see exact log
269-
assert log == """UMAPI timeout...service unavailable (code 429 on try 1)
270-
Next retry in 3 seconds...
271-
UMAPI timeout...service unavailable (code 429 on try 2)
272-
Next retry in 3 seconds...
273-
UMAPI timeout...service unavailable (code 429 on try 3)
268+
assert log == """UMAPI request limit reached (code 429 on try 1)
269+
waiting 3 seconds to continue...
270+
UMAPI request limit reached (code 429 on try 2)
271+
waiting 3 seconds to continue...
272+
UMAPI request limit reached (code 429 on try 3)
274273
UMAPI timeout...giving up after 3 attempts (6 seconds).
275274
"""
276275

277-
278276
def test_get_server_fail():
279277
with mock.patch("umapi_client.connection.requests.Session.get") as mock_get:
280278
mock_get.return_value = MockResponse(500, text="500 test server failure")

0 commit comments

Comments
 (0)