def test_raises_call_action_error_on_error(test_error): errors = [test_error] with raises_call_action_error() as exc_info: raise Client.CallActionError( actions=[ActionResponse(action='', errors=errors)]) assert exc_info.soa_errors == errors
def assertActionRunsWithAndReturnErrors(self, action, body, **kwargs): # type: (six.text_type, Body, **Any) -> List[Error] """ Calls `self.call_action` and asserts that it runs with errors, and returns those errors. """ with raises_call_action_error() as exc_info: self.call_action(action, body, **kwargs) return exc_info.soa_errors
def test_raises_call_action_error_different_error(exception_cls): with pytest.raises(exception_cls): with raises_call_action_error(): raise exception_cls()
def test_raises_call_action_error_no_error(): with pytest.raises(pytest.raises.Exception): with raises_call_action_error(): pass # no error here means raises_call_action_error will fail
def assertActionRunsWithAndReturnErrors(self, action, body, **kwargs): with raises_call_action_error() as exc_info: self.call_action(action, body, **kwargs) return exc_info.soa_errors