Skip to content

Commit 17c27cf

Browse files
author
Joe Stubbs
committed
Tests to cover adding a core API subscription.
1 parent 52f1acc commit 17c27cf

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

agave_clients/tests/test_clients.py

+24-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
# To run the test suite:
1010
# Make sure the clients service is running on BASE_URL defined below. In particular, to run the tests against the
1111
# django development server, simply:
12-
# 1. activate a virtualenv with the requirements installed.
12+
# 1. activate a virtualenv with the requirements installed. (Note that to build the virtualenv you may need to
13+
# sudo apt-get install libmysqlclient-dev in Ubuntu distributions).
1314
# 2. Make sure test_settings.py is configured for the appropriate instance of APIM (see #3 above).
1415
# 3. start the dev server (e.g. python manage.py runserver 0.0.0.0:9000)
1516
# 4. run the tests by entering `py.test` in this directory.
@@ -200,6 +201,28 @@ def test_ensure_all_subscriptions_gone(headers, client_attrs):
200201
subs = validate_response(rsp)
201202
assert len(subs) == 0
202203

204+
def test_add_core_api_subscription(headers, client_attrs):
205+
url = '{}/clients/v2/{}/subscriptions'.format(BASE_URL, client_attrs.get('clientName'))
206+
data = {'apiName': 'Files',
207+
'apiVersion': 'v2',
208+
'apiProvider': 'admin',
209+
'tier': 'Unlimited'}
210+
rsp = requests.post(url, data=data, headers=headers)
211+
validate_response(rsp)
212+
213+
def test_ensure_added_core_subscription_present(headers, client_attrs):
214+
url = '{}/clients/v2/{}/subscriptions'.format(BASE_URL, client_attrs.get('clientName'))
215+
rsp = requests.get(url, headers=headers)
216+
subs = validate_response(rsp)
217+
for sub in subs:
218+
if sub.get('apiName') == 'Files':
219+
break
220+
else:
221+
# didn't find the subscription
222+
assert False
223+
224+
225+
203226
def test_delete_client(headers, client_attrs):
204227
url = '{}/clients/v2/{}'.format(BASE_URL, client_attrs.get('clientName'))
205228
rsp = requests.delete(url, headers=headers)

0 commit comments

Comments
 (0)