示例#1
0
 def test_is_authenticated_failure_wrong_credentials(self):
     request = self.DummyRequest('basic', 'other_user', 'other_pass')
     result = basic_auth.is_authenticated(request.META['HTTP_AUTHORIZATION'])
     self.assertFalse(result)
示例#2
0
 def test_authenticate_failure_wrong_type(self):
     request = self.DummyRequest('non_basic', 'user', 'pass')
     result = basic_auth.is_authenticated(request.META['HTTP_AUTHORIZATION'])
     self.assertEqual(result, None)
示例#3
0
 def test_is_authenticated_success(self):
     request = self.DummyRequest('basic', 'user', 'pass')
     result = basic_auth.is_authenticated(request.META['HTTP_AUTHORIZATION'])
     self.assertTrue(result)
示例#4
0
 def test_is_authenticated_failure_wrong_credentials(self):
     request = self.DummyRequest('basic', 'other_user', 'other_pass')
     result = basic_auth.is_authenticated(
         request.META['HTTP_AUTHORIZATION'])
     self.assertFalse(result)
示例#5
0
 def test_authenticate_failure_wrong_type(self):
     request = self.DummyRequest('non_basic', 'user', 'pass')
     result = basic_auth.is_authenticated(
         request.META['HTTP_AUTHORIZATION'])
     self.assertEqual(result, None)
示例#6
0
 def test_is_authenticated_success(self):
     request = self.DummyRequest('basic', 'user', 'pass')
     result = basic_auth.is_authenticated(
         request.META['HTTP_AUTHORIZATION'])
     self.assertTrue(result)