Ejemplo n.º 1
0
def test_get_app_property(app):
    coney = Coney(app)

    assert coney.app == app

    my_app = coney.get_app()

    assert my_app == app
Ejemplo n.º 2
0
def coney(app):
    with app.app_context():
        coney = Coney(app)
        yield coney

        for consumer, thread in get_state(app).consumer_threads:
            consumer.stop()
            thread.join()
Ejemplo n.º 3
0
from flask import Flask
from flask_coney import Coney

app = Flask(__name__)
app.config["CONEY_BROKER_URI"] = "amqp://*****:*****@rabbitmq"
coney = Coney(app)


@coney.queue(queue_name="process")
def process_queue(ch, method, props, body):
    # do something with body
    print(body, flush=True)
Ejemplo n.º 4
0
def test_init_app(app):
    coney = Coney()
    coney.init_app(app)

    assert coney.app is None
    assert app.extensions["coney"] is not None
Ejemplo n.º 5
0
def test_get_app_missing():
    coney = Coney()

    with pytest.raises(RuntimeError):
        coney.get_app()
Ejemplo n.º 6
0
def test_coney_broker_uri_not_set():
    app = Flask(__name__)
    with pytest.raises(RuntimeError):
        Coney(app)