Skip to content

Commit 7fb20d7

Browse files
committed
Ready for live testing. All local tests passing on both py2 and py3. Version bump to 2.0a1.
1 parent 73ea52d commit 7fb20d7

File tree

8 files changed

+198
-164
lines changed

8 files changed

+198
-164
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
setup(name='umapi-client',
25-
version='1.1.a1.dev1',
25+
version='2.0a1',
2626
description='Client for the User Management API (UMAPI) from Adobe - see https://adobe.ly/2h1pHgV',
2727
long_description=('The User Management API (aka the UMAPI) is an Adobe-hosted network service '
2828
'which provides Adobe Enterprise customers the ability to manage their users. This '

tests/test_connections.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
import pytest
2626

2727
from conftest import mock_connection_params, MockResponse
28-
from umapi_client import Connection, TimeoutError, ServerError, RequestError
28+
from umapi_client import Connection, UnavailableError, ServerError, RequestError
29+
2930

3031
def test_get_success():
3132
with mock.patch("umapi_client.connection.requests.get") as mock_get:
@@ -45,56 +46,56 @@ def test_get_retry_header_1():
4546
with mock.patch("umapi_client.connection.requests.get") as mock_get:
4647
mock_get.return_value = MockResponse(429, headers={"Retry-After": "1"})
4748
conn = Connection(**mock_connection_params)
48-
pytest.raises(TimeoutError, conn.make_call, "")
49+
pytest.raises(UnavailableError, conn.make_call, "")
4950

5051

5152
def test_post_retry_header_1():
5253
with mock.patch("umapi_client.connection.requests.post") as mock_post:
5354
mock_post.return_value = MockResponse(429, headers={"Retry-After": "1"})
5455
conn = Connection(**mock_connection_params)
55-
pytest.raises(TimeoutError, conn.make_call, "", "[3, 5]")
56+
pytest.raises(UnavailableError, conn.make_call, "", "[3, 5]")
5657

5758

5859
def test_get_retry_header_time_2():
5960
with mock.patch("umapi_client.connection.requests.get") as mock_get:
6061
mock_get.return_value = MockResponse(502, headers={"Retry-After": formatdate(time.time() + 2.5)})
6162
conn = Connection(**mock_connection_params)
62-
pytest.raises(TimeoutError, conn.make_call, "")
63+
pytest.raises(UnavailableError, conn.make_call, "")
6364

6465

6566
def test_post_retry_header_time_2():
6667
with mock.patch("umapi_client.connection.requests.post") as mock_post:
6768
mock_post.return_value = MockResponse(502, headers={"Retry-After": formatdate(time.time() + 2.5)})
6869
conn = Connection(**mock_connection_params)
69-
pytest.raises(TimeoutError, conn.make_call, "", "[3, 5]")
70+
pytest.raises(UnavailableError, conn.make_call, "", "[3, 5]")
7071

7172

7273
def test_get_retry_header_0():
7374
with mock.patch("umapi_client.connection.requests.get") as mock_get:
7475
mock_get.return_value = MockResponse(503, headers={"Retry-After": "0"})
7576
conn = Connection(**mock_connection_params)
76-
pytest.raises(TimeoutError, conn.make_call, "")
77+
pytest.raises(UnavailableError, conn.make_call, "")
7778

7879

7980
def test_post_retry_header_0():
8081
with mock.patch("umapi_client.connection.requests.post") as mock_post:
8182
mock_post.return_value = MockResponse(503, headers={"Retry-After": "0"})
8283
conn = Connection(**mock_connection_params)
83-
pytest.raises(TimeoutError, conn.make_call, "", "[3, 5]")
84+
pytest.raises(UnavailableError, conn.make_call, "", "[3, 5]")
8485

8586

8687
def test_get_retry_no_header():
8788
with mock.patch("umapi_client.connection.requests.get") as mock_get:
8889
mock_get.return_value = MockResponse(504)
8990
conn = Connection(**mock_connection_params)
90-
pytest.raises(TimeoutError, conn.make_call, "")
91+
pytest.raises(UnavailableError, conn.make_call, "")
9192

9293

9394
def test_post_retry_no_header():
9495
with mock.patch("umapi_client.connection.requests.post") as mock_post:
9596
mock_post.return_value = MockResponse(504)
9697
conn = Connection(**mock_connection_params)
97-
pytest.raises(TimeoutError, conn.make_call, "", "[3, 5]")
98+
pytest.raises(UnavailableError, conn.make_call, "", "[3, 5]")
9899

99100

100101
# log_stream fixture defined in conftest.py
@@ -105,7 +106,7 @@ def test_get_retry_logging(log_stream):
105106
params = dict(mock_connection_params)
106107
params["logger"] = logger
107108
conn = Connection(**params)
108-
pytest.raises(TimeoutError, conn.make_call, "")
109+
pytest.raises(UnavailableError, conn.make_call, "")
109110
stream.flush()
110111
log = stream.getvalue() # save as a local so can do pytest -l to see exact log
111112
assert log == """UMAPI timeout...service unavailable (code 429 on try 1)
@@ -126,7 +127,7 @@ def test_post_retry_logging(log_stream):
126127
params = dict(mock_connection_params)
127128
params["logger"] = logger
128129
conn = Connection(**params)
129-
pytest.raises(TimeoutError, conn.make_call, "", [3, 5])
130+
pytest.raises(UnavailableError, conn.make_call, "", [3, 5])
130131
stream.flush()
131132
log = stream.getvalue() # save as a local so can do pytest -l to see exact log
132133
assert log == """UMAPI timeout...service unavailable (code 429 on try 1)

tests/test_helper.py

Lines changed: 0 additions & 140 deletions
This file was deleted.

0 commit comments

Comments
 (0)