Normalize non-exception from urlparse under Py3k.
| | |
| | | from repoze.who.interfaces import IChallenger |
| | | from repoze.who._compat import construct_url |
| | | from repoze.who._compat import header_value |
| | | from repoze.who._compat import u |
| | | from repoze.who._compat import urlencode |
| | | from repoze.who._compat import urlparse |
| | | from repoze.who._compat import urlunparse |
| | |
| | | reason_param=None, |
| | | reason_header=None, |
| | | ): |
| | | if login_url in (u(''), b'', None): |
| | | raise ValueError("No 'login_url'") |
| | | if reason_header is not None and reason_param is None: |
| | | raise Exception("Can't set 'reason_header' without 'reason_param'.") |
| | | |
| | |
| | | return make_plugin(*args, **kw) |
| | | |
| | | def test_no_login_url_raises(self): |
| | | self.assertRaises(Exception, self._callFUT, None) |
| | | self.assertRaises(ValueError, self._callFUT, None) |
| | | |
| | | def test_defaults(self): |
| | | plugin = self._callFUT('/go_there') |