Skip to content

Commit 7932977

Browse files
author
Sakari Rautiainen
authored
Merge pull request #105 from srautiai/devel
Removed question mark from request
2 parents 4990af0 + e523283 commit 7932977

File tree

2 files changed

+48
-6
lines changed

2 files changed

+48
-6
lines changed

testdroid/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ def upload_test_file(self, project_id, filename):
417417
"""
418418
def delete_project_parameters(self, project_id, parameter_id):
419419
me = self.get_me()
420-
path = "/users/%s/projects/%s/config/parameters/%s" % ( me['id'], project_id, parameter_id )
420+
path = "users/%s/projects/%s/config/parameters/%s" % ( me['id'], project_id, parameter_id )
421421
return self.delete(path=path)
422422

423423
""" Get project parameters

testdroid/tests/test_all.py

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,23 @@
66
import testdroid
77
import responses
88

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)
139
JSON = {'k': 'v'}
1410
PROJECT_ID = 2
1511
TEST_RUN_ID = 3
1612
DEVICE_RUN_ID = 4
1713
DEVICE_SESSION_ID = 5
14+
DEVICE_GROUP_ID = 6
15+
USER_ID = 7
16+
PARAM_ID = 8
1817
TAGS = 'tags'
1918
LIMIT = 0
2019

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+
2126
t = testdroid.Testdroid()
2227

2328

@@ -167,7 +172,7 @@ def test_get_device_run_files_without_tags(self):
167172

168173
@responses.activate
169174
def test_get_device_run_files_with_tags(self):
170-
url = '{}/projects/{}/runs/{}/device-sessions/{}/output-file-set/files?tag[]?={}'.format(
175+
url = '{}/projects/{}/runs/{}/device-sessions/{}/output-file-set/files?tag[]={}'.format(
171176
URL_API_ME, PROJECT_ID, TEST_RUN_ID, DEVICE_SESSION_ID, TAGS)
172177
responses.add(responses.GET, url, json=JSON, status=200)
173178
response = t.get_device_run_files(PROJECT_ID, TEST_RUN_ID,
@@ -180,3 +185,40 @@ def test_get_input_files(self):
180185
URL_API_ME, LIMIT)
181186
responses.add(responses.GET, url, json=JSON, status=200)
182187
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

Comments
 (0)