Exemple #1
0
 def testView(self):
     """
     Check that login_required is assignable to normal views.
     """
     def normal_view(request):
         pass
     login_required(normal_view)
Exemple #2
0
 def testCallable(self):
     """
     Check that login_required is assignable to callable objects.
     """
     class CallableView(object):
         def __call__(self, *args, **kwargs):
             pass
     login_required(CallableView())
Exemple #3
0
    def testView(self):
        """
        Check that login_required is assignable to normal views.
        """
        def normal_view(request):
            pass

        login_required(normal_view)
Exemple #4
0
    def testCallable(self):
        """
        Check that login_required is assignable to callable objects.
        """
        class CallableView(object):
            def __call__(self, *args, **kwargs):
                pass

        login_required(CallableView())
Exemple #5
0
def auth_processor_perms(request):
    return render_to_response('context_processors/auth_attrs_perms.html',
        RequestContext(request, {}, processors=[context_processors.auth]))

def auth_processor_messages(request):
    request.user.message_set.create(message="Message 1")
    return render_to_response('context_processors/auth_attrs_messages.html',
         RequestContext(request, {}, processors=[context_processors.auth]))

def userpage(request):
    pass

# special urls for auth test cases
urlpatterns = urlpatterns + patterns('',
    (r'^logout/custom_query/$', 'nexathan.auth.views.logout', dict(redirect_field_name='follow')),
    (r'^logout/next_page/$', 'nexathan.auth.views.logout', dict(next_page='/somewhere/')),
    (r'^remote_user/$', remote_user_auth_view),
    (r'^password_reset_from_email/$', 'nexathan.auth.views.password_reset', dict(from_email='*****@*****.**')),
    (r'^login_required/$', login_required(password_reset)),
    (r'^login_required_login_url/$', login_required(password_reset, login_url='/somewhere/')),

    (r'^auth_processor_no_attr_access/$', auth_processor_no_attr_access),
    (r'^auth_processor_attr_access/$', auth_processor_attr_access),
    (r'^auth_processor_user/$', auth_processor_user),
    (r'^auth_processor_perms/$', auth_processor_perms),
    (r'^auth_processor_messages/$', auth_processor_messages),
    url(r'^userpage/(.+)/$', userpage, name="userpage"),
)