| # Copyright 2020 The Pigweed Authors |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); you may not |
| # use this file except in compliance with the License. You may obtain a copy of |
| # the License at |
| # |
| # https://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| # License for the specific language governing permissions and limitations under |
| # the License. |
| """Test of label functionality of roll_util.""" |
| |
| DEPS = [ |
| 'fuchsia/status_check', |
| 'pigweed/roll_util', |
| 'recipe_engine/properties', |
| 'recipe_engine/step', |
| ] |
| |
| PYTHON_VERSION_COMPATIBILITY = "PY3" |
| |
| |
| def RunSteps(api): |
| if api.roll_util.labels_to_set: |
| with api.step.nest('labels_to_set') as pres: |
| pres.step_summary_text = repr(api.roll_util.labels_to_set) |
| if api.roll_util.labels_to_wait_on: |
| with api.step.nest('labels_to_wait_on') as pres: |
| pres.step_summary_text = repr(api.roll_util.labels_to_wait_on) |
| |
| assert api.roll_util.test_api.format_prefix('foo') == 'foo.' |
| assert ( |
| api.roll_util.normalize_remote('../foo', 'sso://host/bar') |
| == 'https://host.googlesource.com/foo' |
| ) |
| |
| |
| def GenTests(api): |
| properties = { |
| '$pigweed/roll_util': { |
| 'labels_to_set': [ |
| {'label': 'Trigger', 'value': 1}, |
| {'label': 'Foo', 'value': 123}, |
| ], |
| 'labels_to_wait_on': ['Verified', 'Good'], |
| }, |
| } |
| |
| yield api.status_check.test('labels') + api.properties(**properties) |