Exemple #1
0
def test_default_querybuilder_includes_default_matchers(
        matchers, matcher_type, pyramid_request):
    from memex.search import query
    builder = core.default_querybuilder(pyramid_request)
    type_ = getattr(query, matcher_type)

    assert matchers.instance_of(type_) in builder.matchers
Exemple #2
0
def test_default_querybuilder_includes_registered_matchers(pyramid_request):
    matcher_factory = mock.Mock(return_value=mock.sentinel.MY_MATCHER,
                                spec_set=[])
    pyramid_request.registry[core.MATCHERS_KEY] = [matcher_factory]

    builder = core.default_querybuilder(pyramid_request)

    matcher_factory.assert_called_once_with(pyramid_request)
    assert mock.sentinel.MY_MATCHER in builder.matchers
Exemple #3
0
def test_default_querybuilder_includes_registered_matchers(pyramid_request):
    matcher_factory = mock.Mock(return_value=mock.sentinel.MY_MATCHER,
                                spec_set=[])
    pyramid_request.registry[core.MATCHERS_KEY] = [matcher_factory]

    builder = core.default_querybuilder(pyramid_request)

    matcher_factory.assert_called_once_with(pyramid_request)
    assert mock.sentinel.MY_MATCHER in builder.matchers
Exemple #4
0
def test_default_querybuilder_includes_default_matchers(matchers, matcher_type, pyramid_request):
    from memex.search import query
    builder = core.default_querybuilder(pyramid_request)
    type_ = getattr(query, matcher_type)

    assert matchers.instance_of(type_) in builder.matchers