| # Copyright 2024 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 API for repo_roll.""" |
| |
| from PB.recipe_modules.pigweed.cipd_roll.package import Package |
| from recipe_engine import recipe_test_api |
| |
| |
| class RepoRollTestApi(recipe_test_api.RecipeTestApi): |
| """Test API for repo_roll.""" |
| |
| def read_step_data(self, prefix=None): |
| prefix = f'{prefix.rstrip(".")}.' if prefix else '' |
| |
| return self.step_data( |
| f'{prefix}read manifest', |
| self.m.file.read_text( |
| """ |
| <?xml version="1.0" encoding="UTF-8"?> |
| <manifest> |
| <!-- single-line comment --> |
| <remote name="foo" fetch="sso://foo" review="sso://foo" /> |
| <remote name="bar" fetch="sso://bar" review="sso://bar" /> |
| <remote name="host" fetch=".." review="sso://host" /> |
| <remote name="dotdot-prefix" fetch="../prefix" review="sso://host/prefix" /> |
| <remote name="host-prefix" fetch="sso://host/prefix" |
| review="sso://host/prefix" /> |
| <default remote="bar" /> |
| <project name="a" path="a1" remote="foo" |
| revision="1111111111111111111111111111111111111111" upstream="main"/> |
| <project name="b" path="b2" |
| revision="2222222222222222222222222222222222222222" upstream="main"/> |
| <!-- |
| multi |
| line |
| comment |
| --> |
| <project name="c" path="c3" revision="main"/> |
| <project name="d" path="d4" |
| revision="0000000000111111111122222222223333333333"/> |
| <project name="e5" revision="refs/tags/e"/> |
| <project name="f" path="f6" remote="host" revision="main"/> |
| <project name="g" path="g7" remote="dotdot-prefix" revision="main"/> |
| <project name="h" path="h8" remote="host-prefix" revision="main"/> |
| </manifest> |
| """.lstrip() |
| ), |
| ) |