11
11
from optparse import OptionParser
12
12
from datetime import datetime
13
13
14
- __version__ = '2.69.0 '
14
+ __version__ = '2.69.1 '
15
15
16
16
FORMAT = "%(message)s"
17
17
logging .basicConfig (format = FORMAT )
@@ -240,7 +240,7 @@ def upload(self, path=None, filename=None):
240
240
res = requests .post (url , files = files , headers = self ._build_headers ())
241
241
if res .status_code not in list (range (200 , 300 )):
242
242
raise RequestResponseError (res .text , res .status_code )
243
- return res
243
+ return res . json ()
244
244
245
245
""" GET from API resource
246
246
"""
@@ -391,27 +391,30 @@ def print_projects(self, limit=0):
391
391
for project in self .get_projects (limit )['data' ]:
392
392
print ("%s %s \" %s\" " % (str (project ['id' ]).ljust (10 ), project ['type' ].ljust (15 ), project ['name' ]))
393
393
394
- """ Upload application file to project
394
+ """ ***DEPRECATED*** Upload application file to project
395
+ Consider using upload_file() instead.
395
396
"""
396
397
def upload_application_file (self , project_id , filename ):
398
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
397
399
me = self .get_me ()
398
400
path = "users/%s/projects/%s/files/application" % (me ['id' ], project_id )
399
- self .upload (path = path , filename = filename )
401
+ return self .upload (path = path , filename = filename )
400
402
401
403
""" Upload application file to project
402
404
"""
403
405
def upload_file (self , filename ):
404
406
me = self .get_me ()
405
407
path = "users/%s/files" % (me ['id' ])
406
- res = self .upload (path = path , filename = filename ).json ()
407
- print ("ID:%s Name:%s Size:%s" % (str (res ['id' ]).ljust (10 ), res ['name' ].ljust (15 ), res ['size' ]))
408
+ return self .upload (path = path , filename = filename )
408
409
409
- """ Upload test file to project
410
+ """ ***DEPRECATED*** Upload test file to project
411
+ Consider using upload_file() instead.
410
412
"""
411
413
def upload_test_file (self , project_id , filename ):
414
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
412
415
me = self .get_me ()
413
416
path = "users/%s/projects/%s/files/test" % (me ['id' ], project_id )
414
- self .upload (path = path , filename = filename )
417
+ return self .upload (path = path , filename = filename )
415
418
416
419
""" Delete project parameter
417
420
"""
@@ -426,12 +429,14 @@ def get_project_parameters(self, project_id):
426
429
path = "me/projects/%s/config/parameters" % ( project_id )
427
430
return self .get (path = path )
428
431
429
- """ Upload additional data file to project
432
+ """ ***DEPRECATED*** Upload additional data file to project
433
+ Consider using upload_file() instead.
430
434
"""
431
435
def upload_data_file (self , project_id , filename ):
436
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
432
437
me = self .get_me ()
433
438
path = "users/%s/projects/%s/files/data" % (me ['id' ], project_id )
434
- self .upload (path = path , filename = filename )
439
+ return self .upload (path = path , filename = filename )
435
440
436
441
""" Set project parameters
437
442
"""
@@ -447,9 +452,11 @@ def get_project_config(self, project_id):
447
452
path = "me/projects/%s/config" % ( project_id )
448
453
return self .get (path = path )
449
454
450
- """ Set project config according to http://docs.testdroid.com/_pages/client.html#project-config
455
+ """ ***DEPRECATED*** Set project config
456
+ Consider using start_test_run_using_config() instead.
451
457
"""
452
458
def set_project_config (self , project_id , payload ):
459
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
453
460
#set the project config to reflect the given json payload
454
461
#e.g.: {'usedDeviceGroupId': 1234}
455
462
if isinstance (payload , str ):
@@ -458,13 +465,15 @@ def set_project_config(self, project_id, payload):
458
465
path = "users/%s/projects/%s/config" % ( me ['id' ], project_id )
459
466
return self .post (path = path , payload = payload )
460
467
461
- """Set project framework based on a framework integer id
468
+ """ ***DEPRECATED*** Set project framework based on a framework integer id
469
+ Consider using start_test_run_using_config() instead.
462
470
"""
463
471
def set_project_framework (self , project_id , frameworkId ):
472
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
464
473
path = "projects/%(project_id)s/frameworks" % {
465
474
'project_id' : project_id
466
475
}
467
- self .post (path , payload = {"frameworkId" : frameworkId })
476
+ return self .post (path , payload = {"frameworkId" : frameworkId })
468
477
469
478
470
479
""" Start a test run using test run config
@@ -484,9 +493,11 @@ def start_test_run_using_config(self, test_run_config={}):
484
493
test_run = self .post (path = path , payload = test_run_config , headers = {'Content-type' : 'application/json' , 'Accept' : 'application/json' })
485
494
return test_run
486
495
487
- """ Start a test run on a device group
496
+ """ ***DEPRECATED*** Start a test run on a device group
497
+ Consider using start_test_run_using_config() instead.
488
498
"""
489
499
def start_test_run (self , project_id , device_group_id = None , device_model_ids = None , name = None , additional_params = {}):
500
+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
490
501
# check project validity
491
502
project = self .get_project (project_id )
492
503
if not 'id' in project :
@@ -947,7 +958,7 @@ class MyParser(OptionParser):
947
958
def format_epilog (self , formatter ):
948
959
return self .epilog
949
960
usage = "usage: %prog [options] <command> [arguments...]"
950
- description = "Client for Testdroid Cloud API v2"
961
+ description = "Client for Bitbar Cloud API v2"
951
962
epilog = """
952
963
Commands:
953
964
@@ -965,16 +976,16 @@ def format_epilog(self, formatter):
965
976
CALABASH_IOS
966
977
delete-project <id> Delete a project
967
978
projects Get projects
968
- upload-application <project-id> <filename> Upload application to project
969
- upload-test <project-id> <filename> Upload test file to project
970
- upload-data <project-id> <filename> Upload additional data file to project
979
+ upload-application <project-id> <filename> ***DEPRECATED*** Upload application to project
980
+ upload-test <project-id> <filename> ***DEPRECATED*** Upload test file to project
981
+ upload-data <project-id> <filename> ***DEPRECATED*** Upload additional data file to project
971
982
upload-file <filename> Upload to "Files"
972
983
set-project-config <project-id> <config-json>
973
- Change the project config parameters as facilitated by the API:
974
- http://docs.testdroid.com/_pages/client.html#project-config
984
+ ***DEPRECATED*** Change the project config parameters as facilitated by the API:
975
985
e.g.:
976
986
./testdroid-api-client set-project-config 1234 '{"limitationType":"CLASS", "limitationValue":"com.foo.test.VerifyFoo"}'
977
- start-test-run <project-id> <device-group-id> Start a test run
987
+ start-test-run <project-id> <device-group-id>
988
+ ***DEPRECATED*** Start a test run
978
989
start-wait-download-test-run <project-id> <device-group-id>
979
990
Start a test run, await completion (polling) and
980
991
download results
@@ -996,7 +1007,7 @@ def format_epilog(self, formatter):
996
1007
See the sample of Jenkisfile in http://docs.bitbar.com/build-service/guide.html
997
1008
update-job <job-id> <job-name> <job-configuration>
998
1009
Update existing job
999
- create-build <job-id> <build-configuration> Create a new build job. See https://cloud.testdroid .com/cloud/swagger-ui.html
1010
+ create-build <job-id> <build-configuration> Create a new build job. See https://cloud.bitbar .com/cloud/swagger-ui.html
1000
1011
for details of build configuration
1001
1012
delete-job <job-id> Delete job and all the builds in it
1002
1013
delete-build <job-id> <build-id> Delete build by id
@@ -1032,7 +1043,7 @@ def format_epilog(self, formatter):
1032
1043
"""
1033
1044
parser = MyParser (usage = usage , description = description , epilog = epilog , version = "%s %s" % ("%prog" , __version__ ))
1034
1045
parser .add_option ("-k" , "--apikey" , dest = "apikey" ,
1035
- help = "API key - the API key for Testdroid Cloud. Optional. You can use environment variable TESTDROID_APIKEY as well." )
1046
+ help = "API key - the API key for Bitbar Cloud. Optional. You can use environment variable TESTDROID_APIKEY as well." )
1036
1047
parser .add_option ("-u" , "--username" , dest = "username" ,
1037
1048
help = "Username - the email address. Optional. You can use environment variable TESTDROID_USERNAME as well." )
1038
1049
parser .add_option ("-p" , "--password" , dest = "password" ,
0 commit comments