OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from recipe_engine import recipe_test_api | 5 from recipe_engine import recipe_test_api |
6 | 6 |
7 | 7 |
8 class CIPDTestApi(recipe_test_api.RecipeTestApi): | 8 class CIPDTestApi(recipe_test_api.RecipeTestApi): |
9 def make_resolved_version(self, v): | 9 def make_resolved_version(self, v): |
10 if not v: | 10 if not v: |
(...skipping 12 matching lines...) Expand all Loading... |
23 'instance_id': self.make_resolved_version(version), | 23 'instance_id': self.make_resolved_version(version), |
24 } | 24 } |
25 | 25 |
26 def _resultify(self, result, error=None, retcode=None): | 26 def _resultify(self, result, error=None, retcode=None): |
27 dic = {'result': result} | 27 dic = {'result': result} |
28 if error: | 28 if error: |
29 dic['error'] = error | 29 dic['error'] = error |
30 return self.m.json.output(dic, retcode=retcode) | 30 return self.m.json.output(dic, retcode=retcode) |
31 | 31 |
32 def make_test_executable(self): | 32 def make_test_executable(self): |
33 return str('fake_slave_build/cipd') | 33 return str(self.m.path['slave_build'].join('cipd', 'cipd')) |
34 | 34 |
35 def example_error(self, error, retcode=None): | 35 def example_error(self, error, retcode=None): |
36 return self._resultify( | 36 return self._resultify( |
37 result=None, | 37 result=None, |
38 error=error, | 38 error=error, |
39 retcode=1 if retcode is None else retcode) | 39 retcode=1 if retcode is None else retcode) |
40 | 40 |
41 def example_install_client(self, package_name, version=None, retcode=None): | 41 def example_install_client(self, package_name, version=None, retcode=None): |
42 return self.m.json.output({ | 42 return self.m.json.output({ |
43 'executable': self.make_test_executable(), | 43 'executable': self.make_test_executable(), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 'registered_by': user, | 93 'registered_by': user, |
94 'registered_ts': tstamp, | 94 'registered_ts': tstamp, |
95 } | 95 } |
96 for tag in ([ | 96 for tag in ([ |
97 'buildbot_build:some.waterfall/builder/1234', | 97 'buildbot_build:some.waterfall/builder/1234', |
98 'git_repository:https://chromium.googlesource.com/some/repo', | 98 'git_repository:https://chromium.googlesource.com/some/repo', |
99 'git_revision:397a2597cdc237f3026e6143b683be4b9ab60540', | 99 'git_revision:397a2597cdc237f3026e6143b683be4b9ab60540', |
100 ] if test_data_tags is None else test_data_tags) | 100 ] if test_data_tags is None else test_data_tags) |
101 ], | 101 ], |
102 }) | 102 }) |
OLD | NEW |