def test_queries(app, matcher_config):
    """Get defined queries from configuration."""
    app.config.update(dict(MATCHER_QUERIES=matcher_config))
    with app.app_context():
        expected = [{'type': 'exact', 'match': 'title'}]
        result = get_queries(index='records', doc_type='record')

        assert expected == result
Beispiel #2
0
def test_queries(app, matcher_config):
    """Get defined queries from configuration."""
    app.config.update(dict(MATCHER_QUERIES=matcher_config))
    with app.app_context():
        expected = [{'type': 'exact', 'match': 'title'}]
        result = get_queries(index='records', doc_type='record')

        assert expected == result
def test_get_queries(app):
    """Dispatch the retrieval of queries."""
    with app.app_context():
        index = "records"
        doc_type = "record"
        app.config.update({"MATCHER_QUERIES": {
            index: {doc_type: [{'type': 'exact', 'match': 'titles.title'}]}
        }})
        expected = [{'type': 'exact', 'match': 'titles.title'}]
        result = get_queries(index, doc_type)

        assert expected == result
Beispiel #4
0
def test_get_queries(app):
    """Dispatch the retrieval of queries."""
    with app.app_context():
        index = "records"
        doc_type = "record"
        app.config.update({
            "MATCHER_QUERIES": {
                index: {
                    doc_type: [{
                        'type': 'exact',
                        'match': 'titles.title'
                    }]
                }
            }
        })
        expected = [{'type': 'exact', 'match': 'titles.title'}]
        result = get_queries(index, doc_type)

        assert expected == result
Beispiel #5
0
    def test_get_queries(self):
        """Dispatch the retrieval of queries."""
        expected = [{'type': 'exact', 'match': 'titles.title'}]
        result = get_queries(foo='foo')

        self.assertEqual(expected, result)