view kallithea/tests/functional/test_basecontroller.py @ 6381:ee6b7e9f34e6

auth: perform basic HTTP security checks already in BaseController There's no reason to postpone these to a LoginRequired decorated controller function. This way, they run unconditionally for all subclasses of BaseController (so everything except JSON-RPC and VCS controllers).
author Søren Løvborg <sorenl@unity3d.com>
date Fri, 23 Sep 2016 00:29:30 +0200
parents
children
line wrap: on
line source

from kallithea.tests.base import TestController, url


class TestBaseController(TestController):

    def test_banned_http_methods(self):
        self.app.request(url(controller='login', action='index'), method='PUT', status=405)
        self.app.request(url(controller='login', action='index'), method='DELETE', status=405)

    def test_banned_http_method_override(self):
        self.app.get(url(controller='login', action='index'), {'_method': 'POST'}, status=405)
        self.app.post(url(controller='login', action='index'), {'_method': 'PUT'}, status=405)