Exemple #1
0
    def test_it_returns_404_when_feature_turned_off(self, group,
                                                    pyramid_request):
        pyramid_request.feature.flags['search_page'] = False

        for user in (None, group.creator, group.members[-1]):
            pyramid_request.authenticated_user = user
            with pytest.raises(httpexceptions.HTTPNotFound):
                activity.toggle_user_facet(pyramid_request)
Exemple #2
0
    def test_it_returns_404_when_feature_turned_off(self,
                                                    group,
                                                    pyramid_request):
        pyramid_request.feature.flags['search_page'] = False

        for user in (None, group.creator, group.members[-1]):
            pyramid_request.authenticated_user = user
            with pytest.raises(httpexceptions.HTTPNotFound):
                activity.toggle_user_facet(pyramid_request)
Exemple #3
0
    def test_it_preserves_query_when_removing_user_facet(
            self, group, pyramid_request):
        pyramid_request.params['q'] = 'user:"******" foo bar'

        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == ('http://example.com/groups/{pubid}/search'
                                   '?q=foo+bar'.format(pubid=group.pubid))
Exemple #4
0
    def test_it_preserves_query_when_removing_one_of_multiple_username_facets(
            self, group, pyramid_request):
        pyramid_request.POST['q'] = 'user:"******" user:"******" user:"******"'

        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search'
            '?q=user%3Afoo+user%3Abar'.format(pubid=group.pubid))
Exemple #5
0
    def test_it_removes_the_user_facet_from_the_url(self, group,
                                                    pyramid_request):
        pyramid_request.params['q'] = 'user:"******"'

        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search?q='.format(
                pubid=group.pubid))
Exemple #6
0
    def test_it_preserves_query_when_removing_user_facet(self,
                                                         group,
                                                         pyramid_request):
        pyramid_request.POST['q'] = 'user:"******" foo bar'

        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search'
            '?q=foo+bar'.format(pubid=group.pubid))
Exemple #7
0
    def test_it_removes_the_user_facet_from_the_url(self,
                                                    group,
                                                    pyramid_request):
        pyramid_request.POST['q'] = 'user:"******"'

        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search?q='.format(
                pubid=group.pubid))
Exemple #8
0
    def test_it_adds_the_user_facet_into_the_url(self, group, pyramid_request):
        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search'
            '?q=user%3Afred'.format(pubid=group.pubid))
Exemple #9
0
    def test_it_returns_a_redirect(self, pyramid_request):
        result = activity.toggle_user_facet(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)
Exemple #10
0
    def test_it_adds_the_user_facet_into_the_url(self, group, pyramid_request):
        result = activity.toggle_user_facet(pyramid_request)

        assert result.location == (
            'http://example.com/groups/{pubid}/search'
            '?q=user%3Afred'.format(pubid=group.pubid))
Exemple #11
0
    def test_it_returns_a_redirect(self, pyramid_request):
        result = activity.toggle_user_facet(pyramid_request)

        assert isinstance(result, httpexceptions.HTTPSeeOther)