Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: appengine/chromium_rietveld/tests/test_buildbucket.py

Issue 1344253002: Rietveld: schedule builds on buildbucket (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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()

Powered by Google App Engine
This is Rietveld 408576698