Beispiel #1
0
 def test_get_login_url_remote_login_url(self):
     r = RequestFactory()
     request = r.get('/')
     request.META['REMOTE_USER'] = '******'
     with patch("nav.web.auth._config.getboolean", return_value=True):
         with patch("nav.web.auth._config.get", return_value='foo'):
             result = auth.get_login_url(request)
             assert result == 'foo'
Beispiel #2
0
def auth(request):
    """Add the correct login url and logout url to context"""
    login_url = get_login_url(request)
    logout_url = get_logout_url(request)
    return {
        'login_url': login_url,
        'logout_url': logout_url,
    }
Beispiel #3
0
 def test_get_login_url_default(self):
     r = RequestFactory()
     request = r.get('/')
     raw_login_url = auth.LOGIN_URL
     result = auth.get_login_url(request)
     assert result.startswith(raw_login_url)