Exemplo n.º 1
0
def setUp():
    g._push_object(Globals())
    c._push_object(mock.Mock())
    request._push_object(Request.blank('/'))
    ThreadLocalORMSession.close_all()
    M.EmailAddress.query.remove({})
    M.OpenIdNonce.query.remove({})
    M.OpenIdAssociation.query.remove({})
Exemplo n.º 2
0
def setup_unit_test():
    try:
        while True:
            REGISTRY.cleanup()
    except:
        pass
    REGISTRY.prepare()
    REGISTRY.register(ew.widget_context,
                      ew.core.WidgetContext('http', ew.ResourceManager()))
    REGISTRY.register(g, Globals())
    REGISTRY.register(c, mock.Mock())
    REGISTRY.register(url, lambda: None)
    REGISTRY.register(request, Request.blank('/', remote_addr='127.0.0.1'))
    REGISTRY.register(response, Response())
    REGISTRY.register(allura.credentials, allura.lib.security.Credentials())
    c.model_cache = None
    ThreadLocalORMSession.close_all()
Exemplo n.º 3
0
def setup_unit_test():
    try:
        while True:
            REGISTRY.cleanup()
    except:
        pass
    REGISTRY.prepare()
    REGISTRY.register(ew.widget_context,
                      ew.core.WidgetContext('http', ew.ResourceManager()))
    REGISTRY.register(g, Globals())
    REGISTRY.register(c, mock.Mock())
    REGISTRY.register(url, lambda: None)
    REGISTRY.register(response, Response())
    REGISTRY.register(session, beaker.session.SessionObject({}))
    REGISTRY.register(allura.credentials, allura.lib.security.Credentials())
    c.memoize_cache = {}
    c.queued_messages = None
    c.model_cache = None
    ThreadLocalORMSession.close_all()
Exemplo n.º 4
0
def setUp():
    g._push_object(Globals())
    c._push_object(mock.Mock())
    c.user._id = None
    c.project = mock.Mock()
    c.project.name = 'Test Project'
    c.project.shortname = 'tp'
    c.project._id = 'testproject/'
    c.project.database_uri = 'mim://nosetest:project'
    c.project.url = lambda: '/testproject/'
    app_config = mock.Mock()
    app_config._id = None
    app_config.project_id = 'testproject/'
    app_config.tool_name = 'tool'
    app_config.options = Object(mount_point = 'foo')
    c.app = mock.Mock()
    c.app.config = app_config
    c.app.config.script_name = lambda:'/testproject/test_application/'
    c.app.config.url = lambda:'http://testproject/test_application/'
    c.app.url = c.app.config.url()
    c.app.__version__ = '0.0'
Exemplo n.º 5
0
def setup_unit_test():
    try:
        while True:
            REGISTRY.cleanup()
    except Exception:
        pass
    REGISTRY.prepare()
    REGISTRY.register(ew.widget_context,
                      ew.core.WidgetContext('http', ew.ResourceManager()))
    REGISTRY.register(allura.credentials, allura.lib.security.Credentials())

    # turbogears has its own special magic wired up for its globals, can't use a regular Registry
    tgl = RequestLocals()
    tgl.app_globals = Globals()
    tgl.tmpl_context = mock.Mock()
    tgl.url = lambda: None
    tgl.request = Request.blank('/', remote_addr='127.0.0.1')
    tgl.response = Response()
    tg.request_local.context._push_object(tgl)

    c.model_cache = None
    ThreadLocalORMSession.close_all()