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)
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))
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))
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))
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))
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))
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))
def test_it_returns_a_redirect(self, pyramid_request): result = activity.toggle_user_facet(pyramid_request) assert isinstance(result, httpexceptions.HTTPSeeOther)