Пример #1
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
Пример #2
0
def test_default_querybuilder_includes_registered_matchers():
    matcher_factory = mock.Mock(return_value=mock.sentinel.MY_MATCHER,
                                spec_set=[])
    request = dummy_request()
    request.registry[core.MATCHERS_KEY] = [matcher_factory]

    builder = core.default_querybuilder(request)

    matcher_factory.assert_called_once_with(request)
    assert mock.sentinel.MY_MATCHER in builder.matchers
Пример #3
0
def test_default_querybuilder_includes_registered_filters():
    filter_factory = mock.Mock(return_value=mock.sentinel.MY_FILTER,
                               spec_set=[])
    request = dummy_request()
    request.registry[core.FILTERS_KEY] = [filter_factory]

    builder = core.default_querybuilder(request)

    filter_factory.assert_called_once_with(request)
    assert mock.sentinel.MY_FILTER in builder.filters
Пример #4
0
def test_default_querybuilder_includes_default_matchers(matcher_type):
    request = dummy_request()

    builder = core.default_querybuilder(request)

    assert instance_of_type(matcher_type) in builder.matchers
Пример #5
0
def test_default_querybuilder_passes_private_to_AuthFilter(private, query):
    request = dummy_request()

    core.default_querybuilder(request, private=private)

    query.AuthFilter.assert_called_once_with(request, private=private)
Пример #6
0
def test_default_querybuilder_includes_default_matchers(matcher_type):
    request = dummy_request()

    builder = core.default_querybuilder(request)

    assert instance_of_type(matcher_type) in builder.matchers
Пример #7
0
def test_default_querybuilder_passes_private_to_AuthFilter(private, query):
    request = dummy_request()

    core.default_querybuilder(request, private=private)

    query.AuthFilter.assert_called_once_with(request, private=private)
Пример #8
0
def test_default_querybuilder_includes_default_matchers(matcher_type, pyramid_request):
    builder = core.default_querybuilder(pyramid_request)

    assert instance_of_type(matcher_type) in builder.matchers
Пример #9
0
def test_default_querybuilder_passes_private_to_AuthFilter(private, query, pyramid_request):
    core.default_querybuilder(pyramid_request, private=private)

    query.AuthFilter.assert_called_once_with(pyramid_request, private=private)