From 7ea4c7d17e450fbdca85c924ea22ddb6833c0d8e Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Fri, 7 Aug 2015 13:01:49 -0400 Subject: [PATCH] Add missing JSON schema for 'refs' and 'branch_name' Fixes #325 --- endpoints/api/trigger.py | 8 ++++++++ test/test_api_usage.py | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/endpoints/api/trigger.py b/endpoints/api/trigger.py index d44cb78a1..5ec5c4b0c 100644 --- a/endpoints/api/trigger.py +++ b/endpoints/api/trigger.py @@ -400,6 +400,14 @@ class ActivateBuildTrigger(RepositoryParamResource): 'commit_sha': { 'type': 'string', 'description': '(Custom Only) If specified, the ref/SHA1 used to checkout a git repository.' + }, + 'refs': { + 'type': 'array', + 'description': '(SCM Only) If specified, the refs to build.' + }, + 'branch_name': { + 'type': 'string', + 'description': '(SCM Only) If specified, the branch to build.' } }, 'additionalProperties': False diff --git a/test/test_api_usage.py b/test/test_api_usage.py index 419d3ffc8..4ef0e406b 100644 --- a/test/test_api_usage.py +++ b/test/test_api_usage.py @@ -2989,6 +2989,13 @@ class TestBuildTriggers(ApiTestCase): build_obj = database.RepositoryBuild.get(database.RepositoryBuild.uuid == start_json['id']) self.assertEquals('bar', py_json.loads(build_obj.job_config)['trigger_metadata']['foo']) + # Start another manual build, with a ref. + start_json = self.postJsonResponse(ActivateBuildTrigger, + params=dict(repository=ADMIN_ACCESS_USER + '/simple', + trigger_uuid=trigger.uuid), + data=dict(refs=[{'kind': 'branch', 'name': 'foobar'}]), + expected_code=201) + def test_invalid_robot_account(self): self.login(ADMIN_ACCESS_USER)