示例#1
0
class TakeoverBackendTest(TestCase):
    def setUp(self):
        self.b = TakeoverBackend()
        self.ub = User.objects.create_user(username='******')
        self.uj = User.objects.create_user(username='******')
        self.uj.is_superuser = True
    
    def test_authenticate(self):
        self.assertFalse(self.b.authenticate(user=self.ub))
        self.assertFalse(self.b.authenticate(user=self.ub, current_user=self.ub))
        self.assertEqual(self.b.authenticate(user=self.ub, current_user=self.uj), self.ub)
        self.assertEqual(self.b.authenticate(user=self.ub, reset=True), self.ub)
示例#2
0
class TakeoverBackendTest(TestCase):
    def setUp(self):
        self.b = TakeoverBackend()
        self.ub = User.objects.create_user(username='******')
        self.uj = User.objects.create_user(username='******')
        self.uj.is_superuser = True

    def test_authenticate(self):
        self.assertFalse(self.b.authenticate(user=self.ub))
        self.assertFalse(
            self.b.authenticate(user=self.ub, current_user=self.ub))
        self.assertEqual(
            self.b.authenticate(user=self.ub, current_user=self.uj), self.ub)
        self.assertEqual(self.b.authenticate(user=self.ub, reset=True),
                         self.ub)
示例#3
0
 def setUp(self):
     self.b = TakeoverBackend()
     self.ub = User.objects.create_user(username='******')
     self.uj = User.objects.create_user(username='******')
     self.uj.is_superuser = True
示例#4
0
 def setUp(self):
     self.b = TakeoverBackend()
     self.ub = User.objects.create_user(username='******')
     self.uj = User.objects.create_user(username='******')
     self.uj.is_superuser = True