Beispiel #1
0
    def test_redirects_to_search_if_no_user(self, pyramid_request):
        pyramid_request.user = None

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == 'http://example.com/s'
Beispiel #2
0
    def test_redirects_to_search_if_no_user(self, pyramid_request):
        pyramid_request.user = None

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == "http://example.com/s"
Beispiel #3
0
    def test_respects_setting(self, pyramid_request):
        pyramid_request.registry.settings['h.homepage_redirect_url'] = 'https://web.hypothes.is'
        pyramid_request.user = None

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == 'https://web.hypothes.is'
Beispiel #4
0
    def test_redirects_to_user_search_page_for_user(self, factories,
                                                    pyramid_request):
        pyramid_request.user = factories.User(username="******")

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == "http://example.com/u/s/petronela"
Beispiel #5
0
    def test_redirects_to_user_search_page_for_user(self,
                                                    factories,
                                                    pyramid_request):
        pyramid_request.user = factories.User(username='******')

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == 'http://example.com/u/s/petronela'
Beispiel #6
0
    def test_respects_setting(self, pyramid_request):
        pyramid_request.registry.settings[
            "h.homepage_redirect_url"] = "https://web.hypothes.is"
        pyramid_request.user = None

        with pytest.raises(HTTPFound) as exc:
            index_redirect(None, pyramid_request)

        assert exc.value.location == "https://web.hypothes.is"