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

Side by Side Diff: appengine/cr-buildbucket/test/service_test.py

Issue 1082303002: buildbucket: put_batch endpoint (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: removed memcache import Created 5 years, 8 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 unified diff | Download patch
« no previous file with comments | « appengine/cr-buildbucket/test/api_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import contextlib 5 import contextlib
6 import datetime 6 import datetime
7 import json 7 import json
8 8
9 from components import auth 9 from components import auth
10 from components import utils 10 from components import utils
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 build = self.service.add( 59 build = self.service.add(
60 bucket='chromium', 60 bucket='chromium',
61 parameters=params, 61 parameters=params,
62 ) 62 )
63 self.assertIsNotNone(build.key) 63 self.assertIsNotNone(build.key)
64 self.assertIsNotNone(build.key.id()) 64 self.assertIsNotNone(build.key.id())
65 self.assertEqual(build.bucket, 'chromium') 65 self.assertEqual(build.bucket, 'chromium')
66 self.assertEqual(build.parameters, params) 66 self.assertEqual(build.parameters, params)
67 self.assertEqual(build.created_by, auth.get_current_identity()) 67 self.assertEqual(build.created_by, auth.get_current_identity())
68 68
69 def test_add_with_client_operation_id(self):
70 build = self.service.add(
71 bucket='chromium',
72 parameters={'buildername': 'linux_rel'},
73 client_operation_id='1',
74 )
75 build2 = self.service.add(
76 bucket='chromium',
77 parameters={'buildername': 'linux_rel'},
78 client_operation_id='1',
79 )
80 self.assertIsNotNone(build.key)
81 self.assertEqual(build, build2)
82
69 def test_add_with_bad_bucket_name(self): 83 def test_add_with_bad_bucket_name(self):
70 with self.assertRaises(errors.InvalidInputError): 84 with self.assertRaises(errors.InvalidInputError):
71 self.service.add(bucket='chromium as') 85 self.service.add(bucket='chromium as')
72 with self.assertRaises(errors.InvalidInputError): 86 with self.assertRaises(errors.InvalidInputError):
73 self.service.add(bucket='') 87 self.service.add(bucket='')
74 88
75 def test_add_with_leasing(self): 89 def test_add_with_leasing(self):
76 build = self.service.add( 90 build = self.service.add(
77 bucket='chromium', 91 bucket='chromium',
78 lease_expiration_date=utils.utcnow () + datetime.timedelta(seconds=10), 92 lease_expiration_date=utils.utcnow () + datetime.timedelta(seconds=10),
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 self.assertEqual(build.status, model.BuildStatus.SCHEDULED) 640 self.assertEqual(build.status, model.BuildStatus.SCHEDULED)
627 self.assertIsNone(build.lease_key) 641 self.assertIsNone(build.lease_key)
628 642
629 def test_completed_builds_are_not_reset(self): 643 def test_completed_builds_are_not_reset(self):
630 self.test_build.status = model.BuildStatus.COMPLETED 644 self.test_build.status = model.BuildStatus.COMPLETED
631 self.test_build.result = model.BuildResult.SUCCESS 645 self.test_build.result = model.BuildResult.SUCCESS
632 self.test_build.put() 646 self.test_build.put()
633 self.service.reset_expired_builds() 647 self.service.reset_expired_builds()
634 build = self.test_build.key.get() 648 build = self.test_build.key.get()
635 self.assertEqual(build.status, model.BuildStatus.COMPLETED) 649 self.assertEqual(build.status, model.BuildStatus.COMPLETED)
OLDNEW
« no previous file with comments | « appengine/cr-buildbucket/test/api_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698