Add unit tests and mock responses for Binhost.GetBinhosts.
BUG=chromium:1000849
TEST=run_tests
Change-Id: I3c3bdcc260cf40cdf649568df8876db0d4afd16e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1914501
Reviewed-by: Alex Klein <saklein@chromium.org>
Tested-by: Michael Mortensen <mmortensen@google.com>
Commit-Queue: Michael Mortensen <mmortensen@google.com>
diff --git a/api/controller/binhost.py b/api/controller/binhost.py
index 0264111..c5b6784 100644
--- a/api/controller/binhost.py
+++ b/api/controller/binhost.py
@@ -32,7 +32,16 @@
}
-@faux.all_empty
+def _GetBinhostsResponse(_input_proto, output_proto, _config):
+ """Add fake binhosts to a successful response."""
+ new_binhost = output_proto.binhosts.add()
+ new_binhost.uri = ('gs://cr-prebuilt/board/amd64-generic/'
+ 'paladin-R66-17.0.0-rc2/packages/')
+ new_binhost.package_index = 'Packages'
+
+
+@faux.success(_GetBinhostsResponse)
+@faux.empty_error
@validate.require('build_target.name')
@validate.validation_complete
def GetBinhosts(input_proto, output_proto, _config):