Skip to content

Commit 2b3887e

Browse files
authored
Merge pull request #6 from adobe-apiplatform/v1
Yet another rename! This time to the approved (and final) name! So ... now at 1.0.0rc4
2 parents e0972ea + 6a812a4 commit 2b3887e

File tree

9 files changed

+44
-44
lines changed

9 files changed

+44
-44
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
# adobe-umapi-client.py
1+
# umapi-client.py
22

3-
This is a Python client for the Adobe User Management API, aka the
4-
[Adobe UMAPI](https://www.adobe.io/products/usermanagement/docs/gettingstarted.html).
3+
This is a Python client for the User Management API from Adobe, aka the
4+
[UMAPI](https://www.adobe.io/products/usermanagement/docs/gettingstarted.html).
55

6-
The Adobe User Management API is an Adobe-hosted network service
6+
The User Management API is an Adobe-hosted network service
77
which provides Adobe Enterprise customers the ability to manage their users. This
8-
client makes it easy to access the Adobe UMAPI from a local Python application.
8+
client makes it easy to access the UMAPI from a local Python application.
99

1010
This client is open source, maintained by Adobe, and distributed under the terms
1111
of the OSI-approved MIT license. Copyright (c) 2016 Adobe Systems Incorporated.
1212

1313
# Installation
1414

15-
You can get this package from PyPI: `pip install adobe-umapi-client`.
15+
You can get this package from PyPI: `pip install umapi-client`.
1616
Or you can download the posted package from GitHub and use pip
1717
to install from the download.
1818

1919
# Building
2020

2121
1. Clone this repository or download the latest stable release.
22-
2. From the command line, change to the `adobe-umapi-client.py` directory.
22+
2. From the command line, change to the `umapi-client.py` directory.
2323
3. To install, run the command `python setup.py install`.
2424
[**NOTE**: You may need admin/root privileges to install new packages in your environment.
2525
It is recommended that you use `virtualenv` to make a virtual python environment.

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
from setuptools import setup, find_packages
2222

2323

24-
setup(name='adobe-umapi-client',
25-
version='1.0.0rc3',
24+
setup(name='umapi-client',
25+
version='1.0.0rc4',
2626
description='Adobe User Management API (UMAPI) client - see https://adobe.ly/2h1pHgV',
2727
long_description=('The Adobe User Management API (aka the Adobe UMAPI) is an Adobe-hosted network service '
2828
'which provides Adobe Enterprise customers the ability to manage their users. This '
@@ -37,7 +37,7 @@
3737
'Intended Audience :: Developers',
3838
'Intended Audience :: System Administrators',
3939
],
40-
url='https://github.com/adobe-apiplatform/adobe-umapi-client.py',
40+
url='https://github.com/adobe-apiplatform/umapi-client.py',
4141
maintainer='Daniel Brotsky',
4242
maintainer_email='[email protected]',
4343
license='MIT',

tests/test_actions.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
import json
2323
import pytest
2424

25-
from adobe_umapi_client import UMAPI, Action
26-
from adobe_umapi_client.error import UMAPIError, UMAPIRetryError, UMAPIRequestError, ActionFormatError
27-
from adobe_umapi_client.auth import Auth
25+
from umapi_client import UMAPI, Action
26+
from umapi_client.error import UMAPIError, UMAPIRetryError, UMAPIRequestError, ActionFormatError
27+
from umapi_client.auth import Auth
2828

2929

3030
# This method will be used by the mock to replace requests.get / requests.post
@@ -47,23 +47,23 @@ def json(self):
4747
return MockResponse(404, {})
4848

4949

50-
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
50+
@mock.patch('umapi_client.api.requests.get', side_effect=mocked_requests_call)
5151
def test_list_users_success(_):
5252
"""Test Users List - SUCCESS"""
5353
auth = mock.create_autospec(Auth)
5454
api = UMAPI('http://example.com/success', auth)
5555
assert api.users(None) == {"result": "success"}
5656

5757

58-
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
58+
@mock.patch('umapi_client.api.requests.get', side_effect=mocked_requests_call)
5959
def test_list_users_error(_):
6060
"""Test Users List - ERROR"""
6161
auth = mock.create_autospec(Auth)
6262
api = UMAPI('http://example.com/error', auth)
6363
pytest.raises(UMAPIRequestError, api.users, None)
6464

6565

66-
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
66+
@mock.patch('umapi_client.api.requests.get', side_effect=mocked_requests_call)
6767
def test_list_users_failure(_):
6868
"""Test Users List - FAILURE"""
6969
auth = mock.create_autospec(Auth)
@@ -73,15 +73,15 @@ def test_list_users_failure(_):
7373
pytest.raises(UMAPIRetryError, api.users, None)
7474

7575

76-
@mock.patch('adobe_umapi_client.api.requests.get', side_effect=mocked_requests_call)
76+
@mock.patch('umapi_client.api.requests.get', side_effect=mocked_requests_call)
7777
def test_list_groups_success(_):
7878
"""Test Groups List - SUCCESS"""
7979
auth = mock.create_autospec(Auth)
8080
api = UMAPI('http://example.com/success', auth)
8181
assert api.groups(None) == {"result": "success"}
8282

8383

84-
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
84+
@mock.patch('umapi_client.api.requests.post', side_effect=mocked_requests_call)
8585
def test_user_create_success(_):
8686
"""Test User Creation - SUCCESS"""
8787
auth = mock.create_autospec(Auth)
@@ -94,7 +94,7 @@ def test_user_create_success(_):
9494
assert api.action(None, action) == {"result": "success"}
9595

9696

97-
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
97+
@mock.patch('umapi_client.api.requests.post', side_effect=mocked_requests_call)
9898
def test_user_create_error(_):
9999
"""Test User Creation - ERROR"""
100100
auth = mock.create_autospec(Auth)
@@ -106,7 +106,7 @@ def test_user_create_error(_):
106106
pytest.raises(UMAPIRequestError, api.action, None, action)
107107

108108

109-
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
109+
@mock.patch('umapi_client.api.requests.post', side_effect=mocked_requests_call)
110110
def test_user_create_failure(_):
111111
"""Test User Creation - FAILURE"""
112112
auth = mock.create_autospec(Auth)
@@ -121,7 +121,7 @@ def test_user_create_failure(_):
121121
pytest.raises(UMAPIRetryError, api.action, None, action)
122122

123123

124-
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
124+
@mock.patch('umapi_client.api.requests.post', side_effect=mocked_requests_call)
125125
def test_product_add(_):
126126
"""Test Product Add - SUCCESS"""
127127
auth = mock.create_autospec(Auth)
@@ -134,7 +134,7 @@ def test_product_add(_):
134134
assert api.action(None, action) == {"result": "success"}
135135

136136

137-
@mock.patch('adobe_umapi_client.api.requests.post', side_effect=mocked_requests_call)
137+
@mock.patch('umapi_client.api.requests.post', side_effect=mocked_requests_call)
138138
def test_action_format_error(_):
139139
"""Test Action Format Error"""
140140
auth = mock.create_autospec(Auth)

tests/test_helper.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
import pytest
2727
from six import StringIO
2828

29-
import adobe_umapi_client.helper
30-
from adobe_umapi_client import UMAPI
31-
from adobe_umapi_client.error import UMAPIError, UMAPIRetryError
29+
import umapi_client.helper
30+
from umapi_client import UMAPI
31+
from umapi_client.error import UMAPIError, UMAPIRetryError
3232

3333

3434
# This method will be used by the mock to replace UMAPI.users
@@ -59,53 +59,53 @@ def __init__(self, status_code, headers):
5959

6060

6161
# test the pagination on success
62-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
62+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
6363
def test_helper_success(_):
6464
api = UMAPI('', None)
65-
assert adobe_umapi_client.helper.paginate(api.users, 'success') == ["user0", "user1", "user2"]
65+
assert umapi_client.helper.paginate(api.users, 'success') == ["user0", "user1", "user2"]
6666

6767

6868
@pytest.fixture
6969
def reduce_attempts():
7070
# reduce the number of retry attempts
71-
adobe_umapi_client.helper.retry_max_attempts = 3
71+
umapi_client.helper.retry_max_attempts = 3
7272

7373

7474
# test the retry logic with seconds in the header
75-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
75+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
7676
def test_helper_retry_seconds(_, reduce_attempts):
7777
api = UMAPI('', None)
78-
assert adobe_umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
78+
assert umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
7979

8080

8181
# test the retry logic with a time in the header
82-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
82+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
8383
def test_helper_fail_date(_, reduce_attempts):
8484
api = UMAPI('', None)
85-
assert adobe_umapi_client.helper.paginate(api.users, 'retryTime') == ["user1", "user2"]
85+
assert umapi_client.helper.paginate(api.users, 'retryTime') == ["user1", "user2"]
8686

8787

8888
# the default retry waits are really long, so don't use them while testing
8989
@pytest.fixture
9090
def reduce_delay():
9191
# reduce the wait on retry attempts
92-
adobe_umapi_client.helper.retry_max_attempts = 3
93-
adobe_umapi_client.helper.retry_exponential_backoff_factor = 1
94-
adobe_umapi_client.helper.retry_random_delay_max = 3
92+
umapi_client.helper.retry_max_attempts = 3
93+
umapi_client.helper.retry_exponential_backoff_factor = 1
94+
umapi_client.helper.retry_random_delay_max = 3
9595

9696

9797
# test the retry logic with a zero delay in the header
98-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
98+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
9999
def test_helper_retry_zero(_, reduce_delay, reduce_attempts):
100100
api = UMAPI('', None)
101-
assert adobe_umapi_client.helper.paginate(api.users, 'retryNone') == ["user1", "user2"]
101+
assert umapi_client.helper.paginate(api.users, 'retryNone') == ["user1", "user2"]
102102

103103

104104
# test the retry logic with no header
105-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
105+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
106106
def test_helper_retry_noheader(_, reduce_delay, reduce_attempts):
107107
api = UMAPI('', None)
108-
assert adobe_umapi_client.helper.paginate(api.users, 'retryNull') == ["user1", "user2"]
108+
assert umapi_client.helper.paginate(api.users, 'retryNull') == ["user1", "user2"]
109109

110110

111111
# py.test doesn't divert string logging, so use it
@@ -116,18 +116,18 @@ def log_stream():
116116
logger = logging.getLogger('test_logger')
117117
logger.setLevel(logging.WARNING)
118118
logger.addHandler(handler)
119-
prior_logger = adobe_umapi_client.helper.logger
120-
adobe_umapi_client.helper.logger = logger
119+
prior_logger = umapi_client.helper.logger
120+
umapi_client.helper.logger = logger
121121
yield stream
122-
adobe_umapi_client.helper.logger = prior_logger
122+
umapi_client.helper.logger = prior_logger
123123
handler.close()
124124

125125

126126
# test the retry logic with a custom logger
127-
@mock.patch('adobe_umapi_client.UMAPI.users', side_effect=mocked_users)
127+
@mock.patch('umapi_client.UMAPI.users', side_effect=mocked_users)
128128
def test_helper_retry_logging(_, log_stream, reduce_attempts):
129129
api = UMAPI('', None)
130-
assert adobe_umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
130+
assert umapi_client.helper.paginate(api.users, 'retrySecs') == ["user1", "user2"]
131131
log_stream.flush()
132132
log = log_stream.getvalue() # save as a local so can do pytest -l to see exact log
133133
assert log == '''UMAPI service temporarily unavailable (attempt 1) -- 429
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)