Esempio n. 1
0
def setUpModule():
    """Sets up the environment for testing."""
    global server_thread

    server_port = get_free_port()

    FLAGS.fetch_frequency = 100
    FLAGS.fetch_threads = 1
    FLAGS.phantomjs_timeout = 60
    FLAGS.polltime = 1
    FLAGS.queue_idle_poll_seconds = 1
    FLAGS.queue_busy_poll_seconds = 1
    FLAGS.queue_server_prefix = (
        'http://localhost:%d/api/work_queue' % server_port)
    FLAGS.release_server_prefix = 'http://localhost:%d/api' % server_port

    db_path = tempfile.mktemp(suffix='.db')
    logging.info('sqlite path used in tests: %s', db_path)
    server.app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + db_path
    db.drop_all()
    db.create_all()

    server.app.config['CSRF_ENABLED'] = False
    server.app.config['IGNORE_AUTH'] = True
    server.app.config['TESTING'] = True
    run = lambda: server.app.run(debug=False, host='0.0.0.0', port=server_port)

    server_thread = threading.Thread(target=run)
    server_thread.setDaemon(True)
    server_thread.start()

    run_server.run_workers()
Esempio n. 2
0
def setUpModule():
    """Sets up the environment for testing."""
    global server_thread

    server_port = get_free_port()

    FLAGS.fetch_frequency = 100
    FLAGS.fetch_threads = 1
    FLAGS.phantomjs_timeout = 60
    FLAGS.polltime = 1
    FLAGS.queue_idle_poll_seconds = 1
    FLAGS.queue_busy_poll_seconds = 1
    FLAGS.queue_server_prefix = "http://localhost:%d/api/work_queue" % server_port
    FLAGS.release_server_prefix = "http://localhost:%d/api" % server_port

    db_path = tempfile.mktemp(suffix=".db")
    logging.info("sqlite path used in tests: %s", db_path)
    server.app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + db_path
    db.drop_all()
    db.create_all()

    server.app.config["CSRF_ENABLED"] = False
    server.app.config["IGNORE_AUTH"] = True
    server.app.config["TESTING"] = True
    run = lambda: server.app.run(debug=False, host="0.0.0.0", port=server_port)

    server_thread = threading.Thread(target=run)
    server_thread.setDaemon(True)
    server_thread.start()

    run_server.run_workers()
Esempio n. 3
0
def setUpModule():
    """Sets up the environment for testing."""
    global server_thread
    server_thread = test_utils.start_server()
    run_server.run_workers()
Esempio n. 4
0
def setUpModule():
    """Sets up the environment for testing."""
    global server_thread
    server_thread = test_utils.start_server()
    run_server.run_workers()