| OLD | NEW |
| (Empty) | |
| 1 # Copyright 2016 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 components import auth |
| 6 from components import auth_testing |
| 7 from testing_utils import testing |
| 8 |
| 9 import config |
| 10 import swarming |
| 11 |
| 12 |
| 13 class SwarmbucketApiTest(testing.EndpointsTestCase): |
| 14 api_service_cls = swarming.SwarmbucketApi |
| 15 |
| 16 def test_get_builders(self): |
| 17 auth_testing.reset_local_state() |
| 18 auth.bootstrap_group('all', [auth.Anonymous]) |
| 19 config.Bucket( |
| 20 id='master.tryserver.chromium', |
| 21 project_id='chromium', |
| 22 revision='deadbeef', |
| 23 config_content=""" |
| 24 name: "master.tryserver.chromium" |
| 25 acls { |
| 26 role: READER |
| 27 group: "all" |
| 28 } |
| 29 swarming { |
| 30 builders { |
| 31 name: "Windows" |
| 32 category: "Chromium" |
| 33 } |
| 34 builders { |
| 35 name: "Linux" |
| 36 category: "Chromium" |
| 37 } |
| 38 } |
| 39 """, |
| 40 ).put() |
| 41 |
| 42 config.Bucket( |
| 43 id='master.tryserver.v8', |
| 44 project_id='v8', |
| 45 revision='deadbeef', |
| 46 config_content=""" |
| 47 name: "master.tryserver.v8" |
| 48 acls { |
| 49 role: READER |
| 50 group: "all" |
| 51 } |
| 52 """, |
| 53 ).put() |
| 54 |
| 55 config.Bucket( |
| 56 id='secret', |
| 57 project_id='secret', |
| 58 revision='deadbeef', |
| 59 config_content='name: "secret"', |
| 60 ).put() |
| 61 |
| 62 resp = self.call_api('get_builders').json_body |
| 63 self.assertEqual(resp, { |
| 64 'buckets': [ |
| 65 { |
| 66 'name': 'master.tryserver.chromium', |
| 67 'builders': [ |
| 68 {'name': 'Windows', 'category': 'Chromium'}, |
| 69 {'name': 'Linux', 'category': 'Chromium'}, |
| 70 ] |
| 71 } |
| 72 ] |
| 73 }) |
| OLD | NEW |