示例#1
0
文件: main_test.py 项目: welhefna/h
    def test_it_redirects_to_activity_page_if_q_length_great_than_2(self, sidebar_app, pyramid_request):
        pyramid_request.params['q'] = 'tag:foo:bar'
        pyramid_request.matchdict['tag'] = 'foo:bar'
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream(None, pyramid_request)

        assert exc.value.location == 'http://example.com/search?q=tag%3Afoo%3Abar'
示例#2
0
文件: main_test.py 项目: ziqizh/h
    def test_it_does_not_redirect_to_activity_page_if_no_tag_key_value(
            self, sidebar_app, pyramid_request):
        pyramid_request.params['q'] = 'tag-foo'

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#3
0
文件: main_test.py 项目: welhefna/h
    def test_it_redirects_to_activity_page_with_tags_containing_spaces(self, pyramid_request):
        pyramid_request.params['q'] = 'tag:foo bar'
        pyramid_request.matchdict['tag'] = 'foo bar'
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream(None, pyramid_request)

        assert exc.value.location == 'http://example.com/search?q=tag%3A%22foo+bar%22'
示例#4
0
    def test_it_redirects_to_activity_page_with_tags(self, pyramid_request):
        pyramid_request.params["q"] = "tag:foo"
        pyramid_request.matchdict["tag"] = "foo"
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream(None, pyramid_request)

        assert exc.value.location == "http://example.com/search?q=tag%3Afoo"
示例#5
0
文件: main_test.py 项目: ziqizh/h
    def test_it_does_not_redirect_to_activity_page_if_no_q_param(
            self, sidebar_app, pyramid_request):
        pyramid_request.matchdict['tag'] = 'foo'

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#6
0
    def test_it_does_not_redirect_to_activity_page_if_no_tag_key(
            self, sidebar_app, pyramid_request):
        pyramid_request.params["q"] = "foo"

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#7
0
文件: main_test.py 项目: hypothesis/h
    def test_it_redirects_to_activity_page_with_tags(self, pyramid_request):
        pyramid_request.params["q"] = "tag:foo"
        pyramid_request.matchdict["tag"] = "foo"
        with pytest.raises(httpexceptions.HTTPFound) as exc:
            main.stream(None, pyramid_request)

        assert exc.value.location == "http://example.com/search?q=tag%3Afoo"
示例#8
0
文件: main_test.py 项目: hypothesis/h
    def test_it_does_not_redirect_to_activity_page_if_no_tag_key_value(
        self, sidebar_app, pyramid_request
    ):
        pyramid_request.params["q"] = "tag-foo"

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#9
0
文件: main_test.py 项目: hypothesis/h
    def test_it_does_not_redirect_to_activity_page_if_no_q_param(
        self, sidebar_app, pyramid_request
    ):
        pyramid_request.matchdict["tag"] = "foo"

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#10
0
文件: main_test.py 项目: gnott/h
    def test_it_does_not_redirect_to_activity_page_if_no_tag_key(self, sidebar_app, pyramid_request):
        pyramid_request.params['q'] = 'foo'

        main.stream(None, pyramid_request)

        assert sidebar_app.called
示例#11
0
    def test_it_does_not_redirect_to_activity_page_if_no_tag_key(self, render_app, pyramid_request):
        pyramid_request.params['q'] = 'foo'

        main.stream(None, pyramid_request)

        assert render_app.called