Beispiel #1
0
 def test_valid_credentials(self):
     env = {
         'HTTP_AUTHORIZATION':
         'Basic {}'.format(base64.b64encode('foo:bar'))
     }
     self.assertTrue(core.authorized(env, 'foo', 'bar'))
Beispiel #2
0
 def test_bad_credentials(self):
     env = {
         'HTTP_AUTHORIZATION':
         'Basic {}'.format(base64.b64encode('baz:buzz'))
     }
     self.assertFalse(core.authorized(env, 'foo', 'bar'))
Beispiel #3
0
 def test_no_authorization_header(self):
     self.assertFalse(core.authorized({}, 'foo', 'bar'))
Beispiel #4
0
 def test_malformed_authorization_header(self):
     self.assertFalse(
         core.authorized({'HTTP_AUTHORIZATION': 'This is bad.'}, 'foo',
                         'bar'))
Beispiel #5
0
 def test_no_required_credentials(self):
     self.assertFalse(core.authorized({}, None, None))