def test_login_url_helper(settings): settings.CAS_RENEW = False settings.CAS_EXTRA_LOGIN_PARAMS = False settings.CAS_SERVER_URL = 'http://www.example.com/cas/' actual = _login_url('http://testserver/') expected = 'http://www.example.com/cas/login?service=http%3A%2F%2Ftestserver%2F' assert actual == expected
def test_login_url_helper_with_renew(settings): settings.CAS_RENEW = True settings.CAS_EXTRA_LOGIN_PARAMS = None settings.CAS_SERVER_URL = 'http://www.example.com/cas/' actual = _login_url('http://testserver/') # since the dictionary of parameters is unordered, we dont know which # parameter will be first, so just check that both are in the url. assert 'service=http%3A%2F%2Ftestserver%2F' in actual assert 'renew=true' in actual