|
9 | 9 | # To run the test suite:
|
10 | 10 | # Make sure the clients service is running on BASE_URL defined below. In particular, to run the tests against the
|
11 | 11 | # 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). |
13 | 14 | # 2. Make sure test_settings.py is configured for the appropriate instance of APIM (see #3 above).
|
14 | 15 | # 3. start the dev server (e.g. python manage.py runserver 0.0.0.0:9000)
|
15 | 16 | # 4. run the tests by entering `py.test` in this directory.
|
@@ -200,6 +201,28 @@ def test_ensure_all_subscriptions_gone(headers, client_attrs):
|
200 | 201 | subs = validate_response(rsp)
|
201 | 202 | assert len(subs) == 0
|
202 | 203 |
|
| 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 | + |
203 | 226 | def test_delete_client(headers, client_attrs):
|
204 | 227 | url = '{}/clients/v2/{}'.format(BASE_URL, client_attrs.get('clientName'))
|
205 | 228 | rsp = requests.delete(url, headers=headers)
|
|
0 commit comments