Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1031)

Unified Diff: scripts/slave/recipe_modules/recipe_autoroller/test_api.py

Issue 1862383002: build: add recipe code for new autoroller (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698