|
6 | 6 | import testdroid |
7 | 7 | import responses |
8 | 8 |
|
9 | | -URL_BASE = 'https://cloud.bitbar.com' |
10 | | -URL_API = '{}/api/v2'.format(URL_BASE) |
11 | | -URL_API_ME = '{}/me'.format(URL_API) |
12 | | -URL_USERS = '{}/users'.format(URL_BASE) |
13 | 9 | JSON = {'k': 'v'} |
14 | 10 | PROJECT_ID = 2 |
15 | 11 | TEST_RUN_ID = 3 |
16 | 12 | DEVICE_RUN_ID = 4 |
17 | 13 | DEVICE_SESSION_ID = 5 |
| 14 | +DEVICE_GROUP_ID = 6 |
| 15 | +USER_ID = 7 |
| 16 | +PARAM_ID = 8 |
18 | 17 | TAGS = 'tags' |
19 | 18 | LIMIT = 0 |
20 | 19 |
|
| 20 | + |
| 21 | +URL_BASE = 'https://cloud.bitbar.com' |
| 22 | +URL_API = '{}/api/v2'.format(URL_BASE) |
| 23 | +URL_API_ME = '{}/me'.format(URL_API) |
| 24 | +URL_USERS = '{}/users/{}'.format(URL_API,USER_ID) |
| 25 | + |
21 | 26 | t = testdroid.Testdroid() |
22 | 27 |
|
23 | 28 |
|
@@ -180,3 +185,40 @@ def test_get_input_files(self): |
180 | 185 | URL_API_ME, LIMIT) |
181 | 186 | responses.add(responses.GET, url, json=JSON, status=200) |
182 | 187 | self.assertEqual(t.get_input_files(LIMIT), JSON) |
| 188 | + |
| 189 | + @responses.activate |
| 190 | + def test_start_test_run(self): |
| 191 | + url = '{}/projects/2'.format( |
| 192 | + URL_API_ME) |
| 193 | + json = { |
| 194 | + 'id': USER_ID, |
| 195 | + 'name': 'Sample project', |
| 196 | + } |
| 197 | + responses.add(responses.GET, url, json=json, status=200) |
| 198 | + |
| 199 | + responses.add(responses.GET, URL_API_ME, json=json, status=200) |
| 200 | + url = '{}/projects/{}/runs'.format( |
| 201 | + URL_USERS, PROJECT_ID) |
| 202 | + json = { |
| 203 | + 'id': 12, |
| 204 | + 'displayName': "My test run" |
| 205 | + } |
| 206 | + |
| 207 | + |
| 208 | + responses.add(responses.POST, url, json=json, status=201) |
| 209 | + self.assertEqual(t.start_test_run(PROJECT_ID, DEVICE_GROUP_ID), json['id']) |
| 210 | + |
| 211 | + @responses.activate |
| 212 | + def test_delete_project_parameters(self): |
| 213 | + path = 'projects/{}/config/parameters/{}'.format(PROJECT_ID, PARAM_ID) |
| 214 | + url = '{}/{}'.format(URL_USERS, path) |
| 215 | + |
| 216 | + json = { |
| 217 | + 'id': USER_ID |
| 218 | + } |
| 219 | + responses.add(responses.GET, URL_API_ME, json=json, status=200) |
| 220 | + responses.add(responses.DELETE, url, json=JSON, status=204) |
| 221 | + response = t.delete_project_parameters(PROJECT_ID, PARAM_ID) |
| 222 | + self.assertEqual(response.status_code, 204) |
| 223 | + |
| 224 | + |
0 commit comments