예제 #1
0
파일: home_test.py 프로젝트: chinmaygghag/h
    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'
예제 #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"
예제 #3
0
파일: home_test.py 프로젝트: chinmaygghag/h
    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'
예제 #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"
예제 #5
0
파일: home_test.py 프로젝트: chinmaygghag/h
    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'
예제 #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"