web/lib/django/contrib/auth/tests/decorators.py
changeset 38 77b6da96e6f1
parent 29 cc9b7e14412b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/lib/django/contrib/auth/tests/decorators.py	Wed Jun 02 18:57:35 2010 +0200
@@ -0,0 +1,25 @@
+from unittest import TestCase
+
+from django.contrib.auth.decorators import login_required
+
+
+class LoginRequiredTestCase(TestCase):
+    """
+    Tests the login_required decorators
+    """
+    def testCallable(self):
+        """
+        Check that login_required is assignable to callable objects.
+        """
+        class CallableView(object):
+            def __call__(self, *args, **kwargs):
+                pass
+        login_required(CallableView())
+        
+    def testView(self):
+        """
+        Check that login_required is assignable to normal views.
+        """
+        def normal_view(request):
+            pass
+        login_required(normal_view)
\ No newline at end of file