OLD | NEW |
---|---|
1 # Copyright 2015 The LUCI Authors. All rights reserved. | 1 # Copyright 2015 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 """Tests that step_data can accept multiple specs at once.""" | 5 """Tests that step_data can accept multiple specs at once.""" |
6 | 6 |
7 from recipe_engine.recipe_api import Property | |
8 from recipe_engine.post_process import NewFilter, DoesntRun, MustRun | |
9 | |
7 DEPS = [ | 10 DEPS = [ |
8 'step', | 11 'step', |
12 'properties', | |
9 ] | 13 ] |
10 | 14 |
11 def RunSteps(api): | 15 PROPERTIES = { |
16 'fakeit': Property(kind=bool, default=True), | |
17 } | |
18 | |
19 def RunSteps(api, fakeit): | |
12 api.step('something unimportant', ['echo', 'sup doc']) | 20 api.step('something unimportant', ['echo', 'sup doc']) |
13 api.step('something important', ['echo', 'crazy!'], env={'FLEEM': 'VERY YES'}) | 21 api.step('something important', ['echo', 'crazy!'], env={'FLEEM': 'VERY YES'}) |
14 api.step('another important', ['echo', 'INSANITY']) | 22 api.step('another important', ['echo', 'INSANITY']) |
23 if fakeit: | |
24 api.step('fakestep', ['echo', 'FAAAAKE']) | |
25 | |
15 | 26 |
16 def GenTests(api): | 27 def GenTests(api): |
martiniss
2016/10/03 19:14:19
No NewFilter with regex.
iannucci
2016/10/06 22:47:12
yeah I'm going to add real tests for all that.
| |
17 yield api.test('all_steps') | 28 yield api.test('all_steps') + api.post_process(MustRun, 'fakestep') |
18 | 29 |
19 yield (api.test('single_step') | 30 yield (api.test('single_step') |
20 + api.whitelist('something important') | 31 + api.post_process(NewFilter('something important')) |
21 ) | 32 ) |
22 | 33 |
23 yield (api.test('two_steps') | 34 yield (api.test('two_steps') |
24 + api.whitelist('something important') | 35 + api.post_process(NewFilter('something important', 'another important')) |
25 + api.whitelist('another important') | |
26 ) | 36 ) |
27 | 37 |
28 yield (api.test('selection') | 38 f = NewFilter() |
29 + api.whitelist('something important', 'env') | 39 f = f.include('something important', 'env') |
30 + api.whitelist('another important', 'cmd') | 40 f = f.include('another important', 'cmd') |
41 yield (api.test('selection') + api.properties() | |
42 + api.post_process(f) | |
43 + api.post_process(DoesntRun, 'fakestep') | |
31 ) | 44 ) |
32 | 45 |
33 yield (api.test('result') | 46 yield api.test('result') + api.post_process(NewFilter('$result')) |
34 + api.whitelist('$result') | |
35 ) | |
OLD | NEW |