| | |
| | | def default_password_compare(cleartext_password, stored_password_hash): |
| | | try: |
| | | from hashlib import sha1 |
| | | except ImportError: # Python < 2.5 |
| | | from sha import new as sha1 |
| | | except ImportError: # Python < 2.5 #pragma NO COVERAGE |
| | | from sha import new as sha1 #pragma NO COVERAGE |
| | | |
| | | # the stored password is stored as '{SHA}<SHA hexdigest>'. |
| | | # or as a cleartext password (no {SHA} prefix) |
| | |
| | | |
| | | def make_psycopg_conn_factory(**kw): |
| | | # convenience (I always seem to use Postgres) |
| | | def conn_factory(): |
| | | import psycopg2 |
| | | return psycopg2.connect(kw['repoze.who.dsn']) |
| | | return conn_factory |
| | | def conn_factory(): #pragma NO COVERAGE |
| | | import psycopg2 #pragma NO COVERAGE |
| | | return psycopg2.connect(kw['repoze.who.dsn']) #pragma NO COVERAGE |
| | | return conn_factory #pragma NO COVERAGE |
| | | |
| | | class SQLAuthenticatorPlugin: |
| | | implements(IAuthenticator) |
| | |
| | | f = self._getFUT() |
| | | self.assertRaises(ValueError, f, 'name', None, None) |
| | | |
| | | def test_no_connfactory(self): |
| | | f = self._getFUT() |
| | | self.assertRaises(ValueError, f, 'name', 'statement', None) |
| | | |
| | | def test_bad_connfactory(self): |
| | | f = self._getFUT() |
| | | self.assertRaises(ValueError, f, 'name', 'statement', |