コード例 #1
0
ファイル: test_campaigns.py プロジェクト: wearpants/osf.io
    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'])
コード例 #2
0
ファイル: test_campaigns.py プロジェクト: 545zhou/osf.io
 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']())
コード例 #3
0
ファイル: test_campaigns.py プロジェクト: 545zhou/osf.io
    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'])
コード例 #4
0
ファイル: test_campaigns.py プロジェクト: wearpants/osf.io
 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']())
コード例 #5
0
ファイル: landing_pages.py プロジェクト: 545zhou/osf.io
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
コード例 #6
0
ファイル: landing_pages.py プロジェクト: wearpants/osf.io
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