def _makeUserRequestContext(user):
    """
    Constructs a class to be used by settings.USERREQUESTCONTEXT_FINDER
    bound to a user, for testing purposes.
    """
    class UserRequestContextTestFinder(object):

        def get_current_user_collections(self):
            return user.user_collection.all()

        def get_current_user_active_collection(self):
            colls = self.get_current_user_collections()
            if colls:
                return colls.get(usercollections__is_default=True)

    return UserRequestContextTestFinder