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