Example #1
0
    def test_auth_login_with_campaign_logged_out(self):
        url = web_url_for('auth_login', campaign='prereg')
        with self.app.app.test_request_context(url):
            data, status_code = auth_views.auth_login()
            assert_equal(status_code, http.OK)

            assert_equal(data['campaign'], 'prereg')
            assert_in('prereg', data['login_url'])
Example #2
0
 def test_auth_login_with_campaign_logged_in(self):
     ensure_schemas()
     url = web_url_for('auth_login', campaign='prereg')
     user = factories.AuthUserFactory()
     with self.app.app.test_request_context(url), mock_auth(user):
         res = auth_views.auth_login()
         assert_equal(res.status_code, http.FOUND)
         assert_equal(res.location, campaigns.CAMPAIGNS['prereg']['redirect_url']())
Example #3
0
    def test_auth_login_with_campaign_logged_out(self):
        url = web_url_for('auth_login', campaign='prereg')
        with self.app.app.test_request_context(url):
            data, status_code = auth_views.auth_login()
            assert_equal(status_code, http.OK)

            assert_equal(data['campaign'], 'prereg')
            assert_in('prereg', data['login_url'])
Example #4
0
 def test_auth_login_with_campaign_logged_in(self):
     ensure_schemas()
     url = web_url_for('auth_login', campaign='prereg')
     user = factories.AuthUserFactory()
     with self.app.app.test_request_context(url), mock_auth(user):
         res = auth_views.auth_login()
         assert_equal(res.status_code, http.FOUND)
         assert_equal(res.location,
                      campaigns.CAMPAIGNS['prereg']['redirect_url']())
Example #5
0
def _landing_page(auth, title, content_path, redirect_to, **kwargs):
    if auth.logged_in:
        return redirect(kwargs.get('redirect_to', redirect_to))
    data = auth_views.auth_login(**kwargs)
    try:
        data[0]['title_text'] = title
        data[0]['content_template_path'] = content_path
        data[0]['login_url'] = cas.get_login_url(redirect_to, auto=True)
    except TypeError:
        pass

    return data
Example #6
0
def _landing_page(auth, title, content_path, redirect_to, **kwargs):
    if auth.logged_in:
        return redirect(kwargs.get('redirect_to', redirect_to))
    data = auth_views.auth_login(**kwargs)
    try:
        data[0]['title_text'] = title
        data[0]['content_template_path'] = content_path
        data[0]['login_url'] = cas.get_login_url(redirect_to, auto=True)
    except TypeError:
        pass

    return data