blob: 89246b7712ffddd7ef73780afc7893e3e6399e05 [file]
# Copyright 2023 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 ci_status.transform_bucket_name()."""
from __future__ import annotations
from collections.abc import Iterator
from recipe_engine import post_process, recipe_test_api
from PB.recipe_modules.pigweed.ci_status.tests.transform_bucket_name import (
InputProperties,
)
DEPS = [
'pigweed/ci_status',
'recipe_engine/properties',
'recipe_engine/step',
]
PROPERTIES = InputProperties
def RunSteps(api, props):
api.step(api.ci_status.transform_bucket_name(props.bucket_name), None)
def GenTests(api) -> Iterator[recipe_test_api.TestData]:
def test(orig, expected):
return api.test(
orig,
api.properties(InputProperties(bucket_name=orig)),
api.post_check(post_process.MustRun, expected),
api.post_process(post_process.DropExpectation),
)
yield test('ci', 'ci')
yield test('try', 'ci')
yield test('foo.ci', 'foo.ci')
yield test('foo.try', 'foo.ci')
yield test('ci.foo', 'ci.foo')
yield test('try.foo', 'ci.foo')
yield test('shadow.ci', 'ci')
yield test('shadow.try', 'ci')
yield test('ci.shadow', 'ci')
yield test('try.shadow', 'ci')
yield test('foo.ci.shadow', 'foo.ci')
yield test('foo.try.shadow', 'foo.ci')
yield test('release', 'release')
yield test('release.shadow', 'release')