def test_prewikka_user_error(): """ Test `prewikka.error.PrewikkaUserError` error. """ # default error = PrewikkaUserError() with pytest.raises(PrewikkaUserError): raise error assert not str(error) # name error = PrewikkaUserError(name='NAME') with pytest.raises(PrewikkaUserError): raise error assert not str(error) # message is required # message error = PrewikkaUserError(message='A message') with pytest.raises(PrewikkaUserError): raise error assert str(error) # name + message error = PrewikkaUserError(name='NAME', message='A message') with pytest.raises(PrewikkaUserError): raise error assert str(error)
def __init__(self, session, message=N_("Authentication failed"), log_priority=log.ERROR, log_user=None): PrewikkaUserError.__init__(self, None, message, log_priority=log_priority, log_user=log_user, template=session.template)
def __init__(self, login=None, **kwargs): PrewikkaUserError.__init__(self, log_user=login, **kwargs)
def __init__(self, login=None, message=None, **kwargs): if message is None: message = _(self._default_message) PrewikkaUserError.__init__(self, None, message, log_user=login, **kwargs)
def __init__(self, login, arguments={}, message=None, template=None): if message is None: message = _("Session expired") PrewikkaUserError.__init__(self, None, message, log_priority=log.ERROR, log_user=login, template=template)
def __init__(self, arguments={}, message=None, login=None, log_priority=None, template=None): if message is None: message = _("Invalid session") PrewikkaUserError.__init__(self, None, message, log_priority=log_priority, log_user=login, template=template)