1111from optparse import OptionParser
1212from datetime import datetime
1313
14- __version__ = '2.69.0 '
14+ __version__ = '2.69.1 '
1515
1616FORMAT = "%(message)s"
1717logging .basicConfig (format = FORMAT )
@@ -240,7 +240,7 @@ def upload(self, path=None, filename=None):
240240 res = requests .post (url , files = files , headers = self ._build_headers ())
241241 if res .status_code not in list (range (200 , 300 )):
242242 raise RequestResponseError (res .text , res .status_code )
243- return res
243+ return res . json ()
244244
245245 """ GET from API resource
246246 """
@@ -391,27 +391,30 @@ def print_projects(self, limit=0):
391391 for project in self .get_projects (limit )['data' ]:
392392 print ("%s %s \" %s\" " % (str (project ['id' ]).ljust (10 ), project ['type' ].ljust (15 ), project ['name' ]))
393393
394- """ Upload application file to project
394+ """ ***DEPRECATED*** Upload application file to project
395+ Consider using upload_file() instead.
395396 """
396397 def upload_application_file (self , project_id , filename ):
398+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
397399 me = self .get_me ()
398400 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 )
400402
401403 """ Upload application file to project
402404 """
403405 def upload_file (self , filename ):
404406 me = self .get_me ()
405407 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 )
408409
409- """ Upload test file to project
410+ """ ***DEPRECATED*** Upload test file to project
411+ Consider using upload_file() instead.
410412 """
411413 def upload_test_file (self , project_id , filename ):
414+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
412415 me = self .get_me ()
413416 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 )
415418
416419 """ Delete project parameter
417420 """
@@ -426,12 +429,14 @@ def get_project_parameters(self, project_id):
426429 path = "me/projects/%s/config/parameters" % ( project_id )
427430 return self .get (path = path )
428431
429- """ Upload additional data file to project
432+ """ ***DEPRECATED*** Upload additional data file to project
433+ Consider using upload_file() instead.
430434 """
431435 def upload_data_file (self , project_id , filename ):
436+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
432437 me = self .get_me ()
433438 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 )
435440
436441 """ Set project parameters
437442 """
@@ -447,9 +452,11 @@ def get_project_config(self, project_id):
447452 path = "me/projects/%s/config" % ( project_id )
448453 return self .get (path = path )
449454
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.
451457 """
452458 def set_project_config (self , project_id , payload ):
459+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
453460 #set the project config to reflect the given json payload
454461 #e.g.: {'usedDeviceGroupId': 1234}
455462 if isinstance (payload , str ):
@@ -458,13 +465,15 @@ def set_project_config(self, project_id, payload):
458465 path = "users/%s/projects/%s/config" % ( me ['id' ], project_id )
459466 return self .post (path = path , payload = payload )
460467
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.
462470 """
463471 def set_project_framework (self , project_id , frameworkId ):
472+ logger .warning ('WARNING: This method has been deprecated and will be removed in the future.' )
464473 path = "projects/%(project_id)s/frameworks" % {
465474 'project_id' : project_id
466475 }
467- self .post (path , payload = {"frameworkId" : frameworkId })
476+ return self .post (path , payload = {"frameworkId" : frameworkId })
468477
469478
470479 """ Start a test run using test run config
@@ -484,9 +493,11 @@ def start_test_run_using_config(self, test_run_config={}):
484493 test_run = self .post (path = path , payload = test_run_config , headers = {'Content-type' : 'application/json' , 'Accept' : 'application/json' })
485494 return test_run
486495
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.
488498 """
489499 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.' )
490501 # check project validity
491502 project = self .get_project (project_id )
492503 if not 'id' in project :
@@ -947,7 +958,7 @@ class MyParser(OptionParser):
947958 def format_epilog (self , formatter ):
948959 return self .epilog
949960 usage = "usage: %prog [options] <command> [arguments...]"
950- description = "Client for Testdroid Cloud API v2"
961+ description = "Client for Bitbar Cloud API v2"
951962 epilog = """
952963Commands:
953964
@@ -965,16 +976,16 @@ def format_epilog(self, formatter):
965976 CALABASH_IOS
966977 delete-project <id> Delete a project
967978 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
971982 upload-file <filename> Upload to "Files"
972983 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:
975985 e.g.:
976986 ./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
978989 start-wait-download-test-run <project-id> <device-group-id>
979990 Start a test run, await completion (polling) and
980991 download results
@@ -996,7 +1007,7 @@ def format_epilog(self, formatter):
9961007 See the sample of Jenkisfile in http://docs.bitbar.com/build-service/guide.html
9971008 update-job <job-id> <job-name> <job-configuration>
9981009 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
10001011 for details of build configuration
10011012 delete-job <job-id> Delete job and all the builds in it
10021013 delete-build <job-id> <build-id> Delete build by id
@@ -1032,7 +1043,7 @@ def format_epilog(self, formatter):
10321043"""
10331044 parser = MyParser (usage = usage , description = description , epilog = epilog , version = "%s %s" % ("%prog" , __version__ ))
10341045 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." )
10361047 parser .add_option ("-u" , "--username" , dest = "username" ,
10371048 help = "Username - the email address. Optional. You can use environment variable TESTDROID_USERNAME as well." )
10381049 parser .add_option ("-p" , "--password" , dest = "password" ,
0 commit comments