'Unit/integration testing helper: registers a dictionary of
:term:`resource` objects that can be resolved via the
:func:`pyramid.traversal.find_resource` API.
The :func:`pyramid.traversal.find_resource` API is called with
a path as one of its arguments.  If the dictionary you
register when calling this method contains that path as a
string key (e.g. ``/foo/bar`` or ``foo/bar``), the
corresponding value will be returned to ``find_resource`` (and
thus to your code) when
:func:`pyramid.traversal.find_resource` is called with an
equivalent path string or tuple.'

def testing_resources(self, resources):

    class DummyTraverserFactory:
        def __init__(self, context):
            self.context = context
        def __call__(self, request):
            path = decode_path_info(request.environ['PATH_INFO'])
            ob = resources[path]
            traversed = split_path_info(path)
            return {'context': ob, 'view_name': '', 'subpath': (), 'traversed': traversed, 'virtual_root': ob, 'virtual_root_path': (), 'root': ob}
    self.registry.registerAdapter(DummyTraverserFactory, (Interface,), ITraverser)
    return resources
