Exemplo n.º 1
0
    def test_authentication_decorator_denies_requests_with_no_username(self):
        decorator = authenticate(None)

        request = testing.DummyRequest()
        request.session['email'] = '*****@*****.**'
        response = decorator(None, request)
        self.assertEqual(response.status, '403 Forbidden')
Exemplo n.º 2
0
    def test_authentication_decorator_accepts_requests_username_and_email(
            self):
        def my_view(request):
            return HTTPOk()

        decorator = authenticate(my_view)

        request = testing.DummyRequest()
        request.session['username'] = '******'
        request.session['email'] = '*****@*****.**'
        response = decorator(testing.DummyResource, request)

        self.assertEqual(response.status, '200 OK')
Exemplo n.º 3
0
    def test_authentication_decorator_denies_requests_with_no_session(self):
        decorator = authenticate(None)

        request = testing.DummyRequest()
        response = decorator(None, request)
        self.assertEqual(response.status, '403 Forbidden')