| Index: scripts/slave/recipe_modules/recipe_autoroller/test_api.py
|
| diff --git a/scripts/slave/recipe_modules/recipe_autoroller/test_api.py b/scripts/slave/recipe_modules/recipe_autoroller/test_api.py
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..f88535cc93d972b99dc1422536915d02129b207c
|
| --- /dev/null
|
| +++ b/scripts/slave/recipe_modules/recipe_autoroller/test_api.py
|
| @@ -0,0 +1,46 @@
|
| +# Copyright 2016 The Chromium Authors. All rights reserved.
|
| +# Use of this source code is governed by a BSD-style license that can be
|
| +# found in the LICENSE file.
|
| +
|
| +from recipe_engine import recipe_test_api
|
| +
|
| +
|
| +class RecipeAutorollerTestApi(recipe_test_api.RecipeTestApi):
|
| + def roll_data(self, project, success=True, trivial=True, empty=False):
|
| + """Returns mock roll data for |project|."""
|
| + if empty:
|
| + success = False
|
| +
|
| + ret = self.empty_test_data()
|
| +
|
| + picked_roll_details = {
|
| + 'commit_infos': {
|
| + 'recipe_engine': [
|
| + {
|
| + 'author': 'foo@chromium.org',
|
| + 'message': 'some commit message',
|
| + 'revision': '123abc',
|
| + },
|
| + ],
|
| + },
|
| + }
|
| +
|
| + roll_result = {
|
| + 'success': success,
|
| + 'trivial': trivial if success else None,
|
| + 'picked_roll_details': picked_roll_details if success else None,
|
| + 'rejected_candidates_details': [],
|
| + }
|
| + if empty:
|
| + roll_result['roll_details'] = []
|
| + else:
|
| + roll_result['roll_details'] = [picked_roll_details]
|
| + if not success:
|
| + roll_result['rejected_candidates_details'].append({
|
| + 'spec': 'some_spec',
|
| + 'commit_infos': {
|
| + },
|
| + })
|
| +
|
| + ret += self.step_data('%s.roll' % project, self.m.json.output(roll_result))
|
| + return ret
|
|
|