Chromium Code Reviews| Index: appengine/chromium_rietveld/tests/test_buildbucket.py |
| diff --git a/appengine/chromium_rietveld/tests/test_buildbucket.py b/appengine/chromium_rietveld/tests/test_buildbucket.py |
| index b4114ddd6f83737488ad18cdf627a358c1118641..5b21c404a56ed5f6d670f803e36c8aab855de6fa 100755 |
| --- a/appengine/chromium_rietveld/tests/test_buildbucket.py |
| +++ b/appengine/chromium_rietveld/tests/test_buildbucket.py |
| @@ -24,6 +24,7 @@ setup.process_args() |
| from google.appengine.api import app_identity |
| +from google.appengine.api import users |
| from google.appengine.ext import ndb |
| from utils import TestCase |
| @@ -176,11 +177,11 @@ class BuildbucketFunctionsTest(TestCase): |
| self.mock(net, 'json_request_async', json_request_async) |
| self.mock(common, 'get_preferred_domain', |
| lambda *_, **__: 'codereview.chromium.org') |
| - |
| - def test_get_try_job_results_for_patchset(self): |
| models.Account.current_user_account = models.Account( |
| email='johndoe@chromium.org') |
| + |
| + def test_get_try_job_results_for_patchset(self): |
| put_builds_response = { |
| 'builds': [ |
| {'id': '1', 'status': 'SCHEDULED'}, |
| @@ -206,6 +207,36 @@ class BuildbucketFunctionsTest(TestCase): |
| put_builds_req_headers['X-Delegation-Token-V1'], |
| 'deltok') |
| + def test_schedule(self): |
| + models.Account.current_user_account = models.Account( |
| + email='johndoe@chromium.org') |
|
tandrii(chromium)
2015/09/16 11:02:32
this is not necessary, you set it up in setUp() no
nodir
2015/09/17 17:44:17
Done.
|
| + |
| + put_builds_response = { |
| + 'results': [ |
| + { |
| + 'build': {'id': '1'}, |
| + }, |
| + { |
| + 'build': {'id': '1'}, |
| + }, |
| + ] |
| + } |
| + self.fake_responses = [ |
| + {'delegation_token': 'deltok', 'validity_duration': 1000}, |
| + put_builds_response, |
| + ] |
| + issue = models.Issue( |
| + id='123', |
| + project='chromium', |
| + owner=users.User(email='owner@chromium.org'), |
| + ) |
| + builds = buildbucket.schedule(issue, '1', [ |
| + ('tryserver.chromium.linux', 'linux_rel'), |
| + ('tryserver.chromium.linux', 'win_rel'), |
| + ]) |
| + self.assertEqual( |
| + builds, [r['build'] for r in put_builds_response['results']]) |
| + |
| if __name__ == '__main__': |
| unittest.main() |