# 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."""

from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:  # pragma: no cover
    from typing import Generator
    from recipe_engine import recipe_test_api

DEPS = [
    'pigweed/roll_util',
    'recipe_engine/step',
]


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.'


def GenTests(api) -> Generator[recipe_test_api.TestData, None, None]:
    yield api.test(
        'labels',
        api.roll_util.properties(
            labels_to_set={'Trigger': 1, 'Foo': 123},
            labels_to_wait_on=['Verified', 'Good'],
        ),
    )
