Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions testdroid/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ def set_project_parameters(self, project_id, parameters):
path = "/users/%s/projects/%s/config/parameters" % ( me['id'], project_id )
reply = self.post(path=path, payload=parameters)


""" Set project config according to http://docs.testdroid.com/_pages/client.html#project-config
"""
def set_project_config(self, project_id, payload):
#set the project config to reflect the given json payload
#e.g.: {'usedDeviceGroupId': 1234}
if isinstance(payload, str):
payload=json.loads(payload)
me = self.get_me()
path = "/users/%s/projects/%s/config" % ( me['id'], project_id )
return self.post(path=path, payload=payload)

""" Start a test run on a device group
"""
def start_test_run(self, project_id, device_group_id=None, device_model_ids=None):
Expand All @@ -337,8 +349,8 @@ def start_test_run(self, project_id, device_group_id=None, device_model_ids=None
print "Device group %s not found" % device_group_id
sys.exit(1)
# Update device group
path = "/users/%s/projects/%s/config" % ( me['id'], project_id )
reply = self.post(path=path, payload={'usedDeviceGroupId': device_group_id})

reply = self.set_project_config(project_id=project_id, payload={'usedDeviceGroupId': device_group_id})
if int(reply['usedDeviceGroupId']) != int(device_group_id):
print "Unable to set used device group to %s for project %s" % (device_group_id, project_id)
sys.exit(1)
Expand Down Expand Up @@ -524,6 +536,10 @@ def format_epilog(self, formatter):
upload-application <project-id> <filename> Upload application to project
upload-test <project-id> <filename> Upload test file to project
upload-data <project-id> <filename> Upload additional data file to project
set-project-config <project-id> <config-json> Change the project config parameters as facilitated by the API:
http://docs.testdroid.com/_pages/client.html#project-config
e.g.:
./testdroid-api-client set-project-config 1234 '{"limitationType":"CLASS", "limitationValue":"com.foo.test.VerifyFoo"}'
start-test-run <project-id> <device-group-id> Start a test run
start-wait-download-test-run <project-id> <device-group-id>
Start a test run, await completion (polling) and
Expand All @@ -535,7 +551,7 @@ def format_epilog(self, formatter):
download-test-run <project-id> <test-run-id> Download test run data. Data will be downloaded to
current directory in a structure:
[test-run-id]/[device-run-id]-[device-name]/files...
download-test-screenshots <project-id> <test-run-id>
download-test-screenshots <project-id> <test-run-id>
Download test run data. Data will be downloaded to
current directory in a structure:
[test-run-id]/[device-run-id]-[device-name]/files...
Expand Down Expand Up @@ -564,6 +580,7 @@ def get_commands(self):
"upload-application": self.upload_application_file,
"upload-test": self.upload_test_file,
"upload-data": self.upload_data_file,
"set-project-config": self.set_project_config,
"start-test-run": self.start_test_run,
"start-wait-download-test-run":self.start_wait_download_test_run,
"wait-test-run":self.wait_test_run,
Expand Down