def test_filter_ignores_non_filter_query_args(self):
     assert_equal(
         filter_clause(
             MultiDict({'fieldName': ['Aa bb'], 'lot': ['saas']})
         ),
         {'bool': {'must': []}}
     )
Exemple #2
0
 def test_filter_ignores_non_filter_query_args(self):
     assert_equal(
         filter_clause(MultiDict({
             'fieldName': ['Aa bb'],
             'lot': ['saas']
         })), {'bool': {
             'must': []
         }})
 def test_single_or_field(self):
     assert_equal(
         filter_clause(MultiDict({'filter_fieldName': ['Aa,Bb']})),
         {'bool': {
             'must': [
                 {"terms": {"filter_fieldName": ['aa', 'bb'], "execution": "bool"}},
             ]
         }}
     )
Exemple #4
0
    def test_or_and_combination(self, services_mapping):
        bool_filter = filter_clause(services_mapping, MultiDict({
            'filter_andFieldName': ['Aa', 'bb'],
            'filter_orFieldName': ['Aa,Bb']
        }))

        assert {"terms": {"dmfilter_orFieldName": ['Aa', 'Bb']}} in bool_filter['bool']['must']
        assert {"term": {"dmfilter_andFieldName": 'Aa'}} in bool_filter['bool']['must']
        assert {"term": {"dmfilter_andFieldName": 'bb'}} in bool_filter['bool']['must']
 def test_single_and_field(self):
     assert_equal(
         filter_clause(MultiDict(
             {'filter_fieldName': ['Aa bb'], 'lot': 'saas'}
         )),
         {'bool': {
             'must': [
                 {"term": {"filter_fieldName": 'aabb'}},
             ]
         }}
     )
Exemple #6
0
 def test_single_or_field(self):
     assert_equal(
         filter_clause(MultiDict({'filter_fieldName': ['Aa,Bb']})), {
             'bool': {
                 'must': [
                     {
                         "terms": {
                             "filter_fieldName": ['aa', 'bb'],
                             "execution": "bool"
                         }
                     },
                 ]
             }
         })
Exemple #7
0
 def test_single_and_field(self):
     assert_equal(
         filter_clause(
             MultiDict({
                 'filter_fieldName': ['Aa bb'],
                 'lot': 'saas'
             })),
         {'bool': {
             'must': [
                 {
                     "term": {
                         "filter_fieldName": 'aabb'
                     }
                 },
             ]
         }})
    def test_or_and_combination(self):
        bool_filter = filter_clause(MultiDict({
            'filter_andFieldName': ['Aa', 'bb'],
            'filter_orFieldName': ['Aa,Bb']
        }))

        assert_in(
            {"terms": {"filter_orFieldName": ['aa', 'bb'], "execution": "bool"}},
            bool_filter['bool']['must']
        )

        assert_in(
            {"term": {"filter_andFieldName": 'aa'}},
            bool_filter['bool']['must']
        )

        assert_in(
            {"term": {"filter_andFieldName": 'bb'}},
            bool_filter['bool']['must']
        )
Exemple #9
0
    def test_or_and_combination(self):
        bool_filter = filter_clause(
            MultiDict({
                'filter_andFieldName': ['Aa', 'bb'],
                'filter_orFieldName': ['Aa,Bb']
            }))

        assert_in(
            {
                "terms": {
                    "filter_orFieldName": ['aa', 'bb'],
                    "execution": "bool"
                }
            }, bool_filter['bool']['must'])

        assert_in({"term": {
            "filter_andFieldName": 'aa'
        }}, bool_filter['bool']['must'])

        assert_in({"term": {
            "filter_andFieldName": 'bb'
        }}, bool_filter['bool']['must'])
Exemple #10
0
 def test_single_or_field(self, services_mapping):
     assert (
         filter_clause(services_mapping, MultiDict({'filter_fieldName': ['Aa,Bb']})) ==
         {'bool': {'must': [{"terms": {"dmfilter_fieldName": ['Aa', 'Bb']}}]}}
     )
Exemple #11
0
 def test_single_and_field(self, services_mapping):
     assert (
         filter_clause(services_mapping, MultiDict({'filter_fieldName': ['Aa bb'], 'lot': 'saas'})) ==
         {'bool': {'must': [{"term": {"dmfilter_fieldName": 'Aa bb'}}]}}
     )
Exemple #12
0
 def test_filter_ignores_non_filter_query_args(self, services_mapping):
     assert (
         filter_clause(services_mapping, MultiDict({'fieldName': ['Aa bb'], 'lot': ['saas']})) ==
         {'bool': {'must': []}}
     )