def test_require_auth_reraises_other_exceptions(self): error = EDAMUserException() def raise_exception(): raise error with pytest.raises(EDAMUserException) as e: app.require_evernote_auth(raise_exception)().status_code assert e.value == error
def test_require_auth_redirects(self): def raise_exception(): raise EDAMUserException(errorCode=EDAMErrorCode.DATA_REQUIRED) with app.app.test_request_context('/'): assert 302 == app.require_evernote_auth(raise_exception)().status_code
def test_require_auth_returns_wrapped_function(self): assert "test_return_value" == app.require_evernote_auth(lambda: "test_return_value")()