def before_all(context): context.app = beer_app.create_app() context.app.config['TESTING'] = True # DEBUG == False if testing flask.app.run with selenium # otherwise it make f*** mess !!! context.app.config['DEBUG'] = False context.baseurl = "http://127.0.0.1:8000/" context.browser = selenium.webdriver.Firefox()
def before_all(context): context.baseurl = "http://127.0.0.1:8000" context.app = beer_app.create_app() context.app.config["TESTING"] = True # fn=(lambda : context.app), it help create the WSGI app object only once, # because function passed into wsgi_intercept is called # once for each intercepted connection # more here: http://ivory.idyll.org/articles/twill-and-wsgi_intercept.html wsgi_intercept.add_wsgi_intercept("127.0.0.1", 8000, lambda: context.app) context.browser = wsgi_intercept.mechanize_intercept.Browser()
def before_all(context): context.baseurl = 'http://127.0.0.1:8000' context.app = beer_app.create_app() context.app.config['TESTING'] = True # fn=(lambda : context.app), it help create the WSGI app object only once, # because function passed into wsgi_intercept is called # once for each intercepted connection # more here: http://ivory.idyll.org/articles/twill-and-wsgi_intercept.html wsgi_intercept.add_wsgi_intercept('127.0.0.1', 8000, lambda: context.app) context.browser = wsgi_intercept.mechanize_intercept.Browser()
def before_all(context): context.baseurl = 'http://127.0.0.1:8000' twill.set_output(StringIO.StringIO()) twill.commands.clear_cookies() context.app = beer_app.create_app() context.app.config['TESTING'] = True # fn=(lambda : context.app), it help create the WSGI app object only once, # because function passed into wsgi_intercept is called # once for each intercepted connection # more here: http://ivory.idyll.org/articles/twill-and-wsgi_intercept.html twill.add_wsgi_intercept('127.0.0.1', 8000, lambda : context.app) context.browser = twill.get_browser()
def before_all(context): context.app = beer_app.create_app() context.app.config['TESTING'] = True context.client = context.app.test_client()
import tornado.wsgi import tornado.httpserver import tornado.ioloop import beer_app app = beer_app.create_app() def run(address="127.0.0.1", port=5000): application = tornado.wsgi.WSGIContainer(app) http_server = tornado.httpserver.HTTPServer(application) http_server.listen(port,address) tornado.ioloop.IOLoop.instance().start() if __name__ == "__main__": run(address="0.0.0.0", port=8000)