BuildAPI: Use faux.empty_completed_unsuccessfully_error for tests.
BUG=chromium:1029872
TEST=run_tests
Change-Id: Id4be0f617e1a9ed1df545c2c7c2970dfbfd796cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/chromite/+/1964694
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 b7f12a9..5162780 100644
--- a/api/controller/test_unittest.py
+++ b/api/controller/test_unittest.py
@@ -61,6 +61,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(test_service, 'DebugInfoTest')
+
+ input_msg = self._GetInput(sysroot_path=self.full_sysroot_path)
+ rc = test_controller.DebugInfoTest(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(test_service, 'DebugInfoTest')
+
+ input_msg = self._GetInput(sysroot_path=self.full_sysroot_path)
+ rc = test_controller.DebugInfoTest(input_msg, self._GetOutput(),
+ self.mock_call_config)
+ patch.assert_not_called()
+ self.assertEqual(controller.RETURN_CODE_SUCCESS, rc)
+
def testNoBuildTargetNoSysrootFails(self):
"""Test missing build target name and sysroot path fails."""
input_msg = self._GetInput()
@@ -120,7 +140,7 @@
os.path.join(input_msg.result_path, 'unit_tests.tar'))
def testMockError(self):
- """Test that a mock error does not execute logic, returns mocked value."""
+ """Test that a mock error does not execute logic, returns error."""
patch = self.PatchObject(test_service, 'BuildTargetUnitTest')
input_msg = self._GetInput(board='board', result_path=self.tempdir)