Ejemplo n.º 1
0
class AuthenticationNotPass(errors.TorextException):
    pass


class ValidationError(errors.TorextException):
    pass


def same_dict(d1, d2):
    return set(d1.keys()) == set(d2.keys()) and\
        not [i for i in d1 if d1[i] != d2[i]]


app = TorextApp()
app.settings['COOKIE_SECRET'] = generate_cookie_secret()


@app.route('/')
class HomeHandler(BaseHandler):
    EXCEPTION_HANDLERS = {
        AuthenticationNotPass: '******',
        (ValidationError, IndexError): '_handle_400'
    }

    def get(self):
        exc = int(self.get_argument('exc'))
        if exc == 0:
            raise AuthenticationNotPass(EXC_MSG_0)
        elif exc == 1:
            raise ValidationError(EXC_MSG_1)
Ejemplo n.º 2
0
class AuthenticationNotPass(errors.TorextException):
    pass


class ValidationError(errors.TorextException):
    pass


def same_dict(d1, d2):
    return set(d1.keys()) == set(d2.keys()) and\
        not [i for i in d1 if d1[i] != d2[i]]


app = TorextApp()
app.settings['COOKIE_SECRET'] = generate_cookie_secret()


@app.route('/')
class HomeHandler(BaseHandler):
    EXCEPTION_HANDLERS = {
        AuthenticationNotPass: '******',
        (ValidationError, IndexError): '_handle_400'
    }

    def get(self):
        exc = int(self.get_argument('exc'))
        if exc == 0:
            raise AuthenticationNotPass(EXC_MSG_0)
        elif exc == 1:
            raise ValidationError(EXC_MSG_1)
Ejemplo n.º 3
0
def test_generate_cookie_secret():
    assert utils.generate_cookie_secret()