def check2(self): """Fake health check 2. Raises: CheckDeviceReadyError: for testing. """ raise errors.CheckDeviceReadyError(self.name, "health check failed")
def test_20_recover_raises_error(self): """Verify recover raises error.""" err_msg = "some error" with self.assertRaisesRegex(errors.CheckDeviceReadyError, err_msg): self.uut.recover( errors.CheckDeviceReadyError(self.uut.name, err_msg))
def test_1340_recover_raises_error(self): """Test recover() raising the error.""" error = errors.CheckDeviceReadyError(self.uut.name, "") with self.assertRaisesRegex(errors.CheckDeviceReadyError, str(error)): self.uut.recover(error)
def test_check_device_ready_error_except_with_error_code(self): """Verifies exception has correct error code for CheckDeviceReadyError.""" error = _raise_and_catch( errors.CheckDeviceReadyError("device-1234", "test")) self.assertEqual(error.err_code, 30)