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)
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)
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