コード例 #1
0
ファイル: query_test.py プロジェクト: ssin122/test-h
    def test_any_query(self):
        anymatcher = query.AnyMatcher()

        result = anymatcher({"any": "foo"})

        assert result == {
            "simple_query_string": {
                "fields": ["quote", "tags", "text", "uri.parts"],
                "query": "foo",
            }
        }
コード例 #2
0
ファイル: core.py プロジェクト: zermelozf/h
def default_querybuilder(request):
    builder = query.Builder()
    builder.append_filter(query.AuthFilter(request))
    builder.append_filter(query.UriFilter(request))
    builder.append_filter(query.GroupFilter())
    builder.append_filter(query.UserFilter())
    builder.append_matcher(query.AnyMatcher())
    builder.append_matcher(query.TagsMatcher())
    for factory in request.registry.get(FILTERS_KEY, []):
        builder.append_filter(factory(request))
    for factory in request.registry.get(MATCHERS_KEY, []):
        builder.append_matcher(factory(request))
    return builder
コード例 #3
0
ファイル: query_test.py プロジェクト: ssin122/test-h
    def test_multiple_params(self):
        """Multiple keywords at once are handled correctly."""
        anymatcher = query.AnyMatcher()
        params = multidict.MultiDict()
        params.add("any", "howdy")
        params.add("any", "there")

        result = anymatcher(params)

        assert result == {
            "simple_query_string": {
                "fields": ["quote", "tags", "text", "uri.parts"],
                "query": "howdy there",
            }
        }