Пример #1
0
def setup():
    global TESTCONFIG
    global TESTAPP

    ## Tests can alter decl. THis resets everything
    reload(decl)

    # using nose-testconfig we obtain the config dict passed in through the
    # nosetests command line
    from testconfig import config
    ## now "convert" to app-style dict
    TESTCONFIG = convert_config(config)
    initdb(TESTCONFIG)
    cj = cookielib.CookieJar()

    ### Are we running by generating HTTP to fire at webserver
    ### or are we testing wsgi calls?
    if 'HTTPPROXY' in config.keys():
        app = WSGIProxyApp(config['HTTPPROXY'])
        app.debug = True
        TESTAPP = TestApp(app, extra_environ={
                          'REMOTE_ADDR': '1.2.3.4'}, cookiejar=cj)
        set_constants(config['HTTPPROXY'], TESTAPP)
    else:
        app = make_app(TESTCONFIG)
        app.debug = True
        sessioncache.set_config(config)
        TESTAPP = TestApp(app.wsgi_app, cookiejar=cj)
        set_constants("", TESTAPP)
Пример #2
0
def setup():
    global TESTCONFIG
    global TESTAPP

    # using nose-testconfig we obtain the config dict passed in through the
    # nosetests command line
    from testconfig import config
    ## now "convert" to app-style dict
    TESTCONFIG = convert_config(config)

    if 'HTTPPROXY' in config.keys():
        app = WSGIProxyApp(config['HTTPPROXY'])
        TESTAPP = TestApp(app, extra_environ={'REMOTE_ADDR': '1.2.3.4'})
    else:
        app = make_app(TESTCONFIG)
        app.debug = True
        TESTAPP = TestApp(app.wsgi_app)


    print "Running setup"
    print "cookies", TESTAPP.cookies 
Пример #3
0
def setup():

    global TESTCONFIG
    global TESTAPP

    # using nose-testconfig we obtain the config dict passed in through the
    # nosetests command line
    from testconfig import config
    ## now "convert" to app-style dict
    TESTCONFIG = convert_config(config)

    # cleardown(TESTCONFIG)
    # initdb(TESTCONFIG)

    if 'HTTPPROXY' in config.keys():
        app = WSGIProxyApp(config['HTTPPROXY'])
        TESTAPP = TestApp(app, extra_environ={'REMOTE_ADDR': '1.2.3.4'})
    else:
#        cleardown(TESTCONFIG)  # use this in setup - via a renaming?
        app = make_app(TESTCONFIG)
        app.debug = True
        TESTAPP = TestApp(app.wsgi_app)