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

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

Issue 2213723002: swarmbucket: allow overriding config (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@sb-cfg-refactoring
Patch Set: security warning Created 4 years, 4 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/swarming/test/swarmingcfg_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
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from google.appengine.ext import ndb
6 from testing_utils import testing
7
8 from proto import project_config_pb2
9 import protoutil
10
11
12 class JsonpbTest(testing.AppengineTestCase):
13 def test_unmarshal_dict(self):
14 msg = project_config_pb2.Swarming()
15 data = {
16 'common_dimensions': ['a:a', 'b:b'],
17 'common_execution_timeout_secs': 600,
18 'common_recipe': {
19 'name': 'trybot',
20 },
21 'builders': [
22 {'name': 'debug'},
23 {'name': 'release'},
24 ],
25 }
26 protoutil.merge_dict(data, msg)
27 self.assertEqual(msg.common_dimensions, ['a:a', 'b:b'])
28 self.assertEqual(msg.common_execution_timeout_secs, 600)
29 self.assertEqual(len(msg.builders), 2)
30 self.assertEqual(msg.builders[0].name, 'debug')
31
32 msg = project_config_pb2.Swarming()
33 with self.assertRaises(TypeError):
34 protoutil.merge_dict([], msg)
35
36 with self.assertRaises(TypeError):
37 protoutil.merge_dict({'no_such_field': 0}, msg)
38
39 with self.assertRaises(TypeError):
40 protoutil.merge_dict({'common_dimensions': 0}, msg)
OLDNEW
« no previous file with comments | « appengine/cr-buildbucket/swarming/test/swarmingcfg_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698