Ejemplo n.º 1
0
class TestAllowNone(TestCase):
    def setUp(self):
        self.permission = AllowNone()
        self.anonymous = AnonymousUser()
        self.user = UserProfile()
        self.request = RequestFactory().get('/')
        self.request.user = self.anonymous

    def test_has_permission_anonymous(self):
        eq_(self.permission.has_permission(self.request, 'myview'), False)

    def test_has_permission_user(self):
        self.request.user = Mock()
        self.request_user = Mock()
        eq_(self.permission.has_permission(self.request, 'myview'), False)

    def test_has_object_permission_anonymous(self):
        obj = Mock()
        eq_(self.permission.has_object_permission(self.request, 'myview', obj),
            False)

    def test_has_object_permission_user(self):
        self.request.user = Mock()
        self.request_user = Mock()
        obj = Mock()
        eq_(self.permission.has_object_permission(self.request, 'myview', obj),
            False)
Ejemplo n.º 2
0
class TestAllowNone(TestCase):
    def setUp(self):
        self.permission = AllowNone()
        self.anonymous = AnonymousUser()
        self.user = UserProfile()
        self.request = RequestFactory().get('/')
        self.request.user = self.anonymous

    def test_has_permission_anonymous(self):
        eq_(self.permission.has_permission(self.request, 'myview'), False)

    def test_has_permission_user(self):
        self.request.user = Mock()
        self.request_user = Mock()
        eq_(self.permission.has_permission(self.request, 'myview'), False)

    def test_has_object_permission_anonymous(self):
        obj = Mock()
        eq_(self.permission.has_object_permission(self.request, 'myview', obj),
            False)

    def test_has_object_permission_user(self):
        self.request.user = Mock()
        self.request_user = Mock()
        obj = Mock()
        eq_(self.permission.has_object_permission(self.request, 'myview', obj),
            False)
Ejemplo n.º 3
0
 def setUp(self):
     self.permission = AllowNone()
     self.anonymous = AnonymousUser()
     self.user = UserProfile()
     self.request = RequestFactory().get('/')
     self.request.user = self.anonymous
Ejemplo n.º 4
0
 def setUp(self):
     self.permission = AllowNone()
     self.anonymous = AnonymousUser()
     self.user = UserProfile()
     self.request = RequestFactory().get('/')
     self.request.user = self.anonymous