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