예제 #1
0
 def test_identify_basic_ok(self):
     from repoze.who._compat import encodebytes
     plugin = self._makeOne('realm')
     value = encodebytes(b'foo:bar').decode('ascii')
     environ = self._makeEnviron({'HTTP_AUTHORIZATION':'Basic %s' % value})
     creds = plugin.identify(environ)
     self.assertEqual(creds, {'login':'******', 'password':'******'})
예제 #2
0
 def test_identify_basic_ok(self):
     from repoze.who._compat import encodebytes
     plugin = self._makeOne('realm')
     value = encodebytes(b'foo:bar').decode('ascii')
     environ = self._makeEnviron({'HTTP_AUTHORIZATION': 'Basic %s' % value})
     creds = plugin.identify(environ)
     self.assertEqual(creds, {'login': '******', 'password': '******'})
예제 #3
0
 def test_identify_basic_ok_latin1_values(self):
     from repoze.who._compat import encodebytes
     LOGIN = b'b\xe2tard'
     PASSWD = b'l\xe0 demain'
     plugin = self._makeOne('realm')
     value = encodebytes(b':'.join((LOGIN, PASSWD))).decode('ascii')
     environ = self._makeEnviron({'HTTP_AUTHORIZATION':'Basic %s' % value})
     creds = plugin.identify(environ)
     self.assertEqual(creds, {'login': LOGIN.decode('latin1'),
                              'password': PASSWD.decode('latin1')})
예제 #4
0
 def test_identify_basic_ok_latin1_values(self):
     from repoze.who._compat import encodebytes
     LOGIN = b'b\xe2tard'
     PASSWD = b'l\xe0 demain'
     plugin = self._makeOne('realm')
     value = encodebytes(b':'.join((LOGIN, PASSWD))).decode('ascii')
     environ = self._makeEnviron({'HTTP_AUTHORIZATION': 'Basic %s' % value})
     creds = plugin.identify(environ)
     self.assertEqual(creds, {
         'login': LOGIN.decode('latin1'),
         'password': PASSWD.decode('latin1')
     })