| OLD | NEW |
| 1 # Copyright 2014 The LUCI Authors. All rights reserved. | 1 # Copyright 2014 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 from recipe_engine.recipe_api import Property | 5 from recipe_engine.recipe_api import Property |
| 6 | 6 |
| 7 DEPS = [ | 7 DEPS = [ |
| 8 'properties', | 8 'properties', |
| 9 'step', | 9 'step', |
| 10 ] | 10 ] |
| 11 | 11 |
| 12 PROPERTIES = { | 12 PROPERTIES = { |
| 13 'test_prop': Property(), | 13 'test_prop': Property(), |
| 14 'foo.bar-bam': Property(param_name='param_name_test'), | 14 'foo.bar-bam': Property(param_name='param_name_test'), |
| 15 } | 15 } |
| 16 | 16 |
| 17 def RunSteps(api, test_prop, param_name_test): | 17 def RunSteps(api, test_prop, param_name_test): |
| 18 api.step('echo', ['echo'] + [repr(test_prop), repr(param_name_test)]) | 18 api.step('echo', ['echo'] + [repr(test_prop), repr(param_name_test)]) |
| 19 | 19 |
| 20 properties = api.properties.thaw() | 20 properties = api.properties.thaw() |
| 21 api.step('echo all', ['echo'] + map(repr, sorted(properties.iteritems()))) | 21 api.step('echo all', ['echo'] + map(repr, sorted(properties.iteritems()))) |
| 22 | 22 |
| 23 # It should behave like a real dictionary. | 23 # It should behave like a real dictionary. |
| 24 assert len(properties) == len(api.properties) | 24 assert len(properties) == len(api.properties) |
| 25 for k in api.properties: | 25 for k in api.properties: |
| 26 assert k in properties | 26 api.step('echo %s' % k, ['echo', repr(api.properties[k])]) |
| 27 # We would assert that v is there too, but sometimes it's frozen... | |
| 28 | 27 |
| 29 | 28 |
| 30 def GenTests(api): | 29 def GenTests(api): |
| 31 pd = {'foo.bar-bam': 'thing'} | 30 pd = {'foo.bar-bam': 'thing'} |
| 32 yield api.test('basic') + api.properties( | 31 yield api.test('basic') + api.properties( |
| 33 test_prop={'key': 'value'}, **pd) | 32 test_prop={'key': 'value'}, **pd) |
| 34 yield api.test('lists') + api.properties( | 33 yield api.test('lists') + api.properties( |
| 35 test_prop={'key': ['value', ['value']]}, **pd) | 34 test_prop={'key': ['value', ['value']]}, **pd) |
| 36 yield api.test('dicts') + api.properties( | 35 yield api.test('dicts') + api.properties( |
| 37 test_prop={'key': {'key': 'value', 'other_key': {'key': 'value'}}}, | 36 test_prop={'key': {'key': 'value', 'other_key': {'key': 'value'}}}, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 64 git_url='https://chrome-internal.googlesource.com/infra/hidden', | 63 git_url='https://chrome-internal.googlesource.com/infra/hidden', |
| 65 **pd)) | 64 **pd)) |
| 66 yield (api.test('buildbot_tryserver_gerrit_override_both') + | 65 yield (api.test('buildbot_tryserver_gerrit_override_both') + |
| 67 api.properties.tryserver( | 66 api.properties.tryserver( |
| 68 gerrit_project='custom', | 67 gerrit_project='custom', |
| 69 gerrit_url='https://gerrit.my.host', | 68 gerrit_url='https://gerrit.my.host', |
| 70 git_url='https://git.my.host/custom', | 69 git_url='https://git.my.host/custom', |
| 71 patch_issue=989898, | 70 patch_issue=989898, |
| 72 patch_set=3, | 71 patch_set=3, |
| 73 **pd)) | 72 **pd)) |
| OLD | NEW |