BuildAPI: Create faux.empty_completed_unsuccessfully_error; use in Test service.
If this looks good, I can follow up with a broader CL to change remaining cases that should use faux.empty_completed_unsuccessfully_error
BUG=chromium:1029872
TEST=run_tests
Change-Id: Ifbe29f35a3bc5a9cb684d20511574b7829e12727
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1949419
Reviewed-by: Alex Klein <saklein@chromium.org>
Commit-Queue: Michael Mortensen <mmortensen@google.com>
Tested-by: Michael Mortensen <mmortensen@google.com>
diff --git a/api/controller/test_unittest.py b/api/controller/test_unittest.py
index 4e08b17..b7f12a9 100644
--- a/api/controller/test_unittest.py
+++ b/api/controller/test_unittest.py
@@ -251,6 +251,26 @@
self.validate_only_config)
patch.assert_not_called()
+ def testMockError(self):
+ """Test mock error call does not execute any logic, returns error."""
+ patch = self.PatchObject(cros_build_lib, 'run')
+
+ input_msg = self._GetInput(chroot_path=self.chroot_path)
+ rc = test_controller.ChromiteUnitTest(input_msg, self._GetOutput(),
+ self.mock_error_config)
+ patch.assert_not_called()
+ self.assertEqual(controller.RETURN_CODE_COMPLETED_UNSUCCESSFULLY, rc)
+
+ def testMockCall(self):
+ """Test mock call does not execute any logic, returns success."""
+ patch = self.PatchObject(cros_build_lib, 'run')
+
+ input_msg = self._GetInput(chroot_path=self.chroot_path)
+ rc = test_controller.ChromiteUnitTest(input_msg, self._GetOutput(),
+ self.mock_call_config)
+ patch.assert_not_called()
+ self.assertEqual(controller.RETURN_CODE_SUCCESS, rc)
+
def testChromiteUnitTest(self):
"""Call ChromiteUnitTest with mocked cros_build_lib.run."""
request = self._GetInput(chroot_path=self.chroot_path)