| OLD | NEW |
| (Empty) |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | |
| 3 # that can be found in the LICENSE file. | |
| 4 | |
| 5 from recipe_engine.recipe_api import Property | |
| 6 | |
| 7 DEPS = [ | |
| 8 'properties', | |
| 9 'step', | |
| 10 ] | |
| 11 | |
| 12 PROPERTIES = { | |
| 13 'test_prop': Property(), | |
| 14 'foo.bar-bam': Property(param_name='param_name_test'), | |
| 15 } | |
| 16 | |
| 17 def RunSteps(api, test_prop, param_name_test): | |
| 18 api.step('echo', ['echo'] + [repr(test_prop), repr(param_name_test)]) | |
| 19 | |
| 20 properties = api.properties.thaw() | |
| 21 api.step('echo all', ['echo'] + map(repr, sorted(properties.iteritems()))) | |
| 22 | |
| 23 # It should behave like a real dictionary. | |
| 24 assert len(properties) == len(api.properties) | |
| 25 for k in api.properties: | |
| 26 api.step('echo %s' % k, ['echo', repr(api.properties[k])]) | |
| 27 | |
| 28 | |
| 29 def GenTests(api): | |
| 30 pd = {'foo.bar-bam': 'thing'} | |
| 31 yield api.test('basic') + api.properties( | |
| 32 test_prop={'key': 'value'}, **pd) | |
| 33 yield api.test('lists') + api.properties( | |
| 34 test_prop={'key': ['value', ['value']]}, **pd) | |
| 35 yield api.test('dicts') + api.properties( | |
| 36 test_prop={'key': {'key': 'value', 'other_key': {'key': 'value'}}}, | |
| 37 **pd) | |
| 38 | |
| 39 yield ( | |
| 40 api.test('exception') + | |
| 41 api.expect_exception('ValueError') | |
| 42 ) | |
| 43 | |
| 44 # Some default buildbot configurations. | |
| 45 pd['test_prop'] = None | |
| 46 yield api.test('buildbot_generic') + api.properties.generic(**pd) | |
| 47 yield (api.test('buildbot_scheduled') + | |
| 48 api.properties.scheduled(**pd)) | |
| 49 yield (api.test('buildbot_git_scheduled') + | |
| 50 api.properties.git_scheduled(**pd)) | |
| 51 yield (api.test('buildbot_tryserver') + | |
| 52 api.properties.tryserver(**pd)) | |
| 53 yield (api.test('buildbot_tryserver_gerrit') + | |
| 54 api.properties.tryserver(gerrit_project='infra/infra', **pd)) | |
| 55 yield (api.test('buildbot_tryserver_gerrit_override_gerrit') + | |
| 56 api.properties.tryserver( | |
| 57 gerrit_project='infra/internal', | |
| 58 gerrit_url='https://chrome-internal-review.googlesource.com', | |
| 59 **pd)) | |
| 60 yield (api.test('buildbot_tryserver_gerrit_override_git') + | |
| 61 api.properties.tryserver( | |
| 62 gerrit_project='infra/hidden', | |
| 63 git_url='https://chrome-internal.googlesource.com/infra/hidden', | |
| 64 **pd)) | |
| 65 yield (api.test('buildbot_tryserver_gerrit_override_both') + | |
| 66 api.properties.tryserver( | |
| 67 gerrit_project='custom', | |
| 68 gerrit_url='https://gerrit.my.host', | |
| 69 git_url='https://git.my.host/custom', | |
| 70 patch_issue=989898, | |
| 71 patch_set=3, | |
| 72 **pd)) | |
| OLD | NEW |