Exemplo n.º 1
0
def test_get_db_while_testing(app):
    app = create_app({"TESTING": True})

    with app.app_context():
        db = get_db()
        assert hasattr(db, "name")
        assert isinstance(db, mongomock.database.Database)
Exemplo n.º 2
0
def test_create_app_registers_blueprints():
    app = create_app()
    assert len(app.blueprints) == 5
    assert app.blueprints["links"]
    assert app.blueprints["preferences"]
    assert app.blueprints["views"]
    assert app.blueprints["notes"]
    assert app.blueprints["archive"]
Exemplo n.º 3
0
def test_get_connection_while_not_testing():
    app = create_app({"TESTING": False})

    with app.app_context():
        assert not hasattr(g, "connection")
        connection = get_connection()
        assert hasattr(g, "connection")
        assert isinstance(connection, MongoClient)
Exemplo n.º 4
0
def app():
    app = create_app({"TESTING": True})

    ctx = app.app_context()
    ctx.push()

    yield app

    ctx.pop()
Exemplo n.º 5
0
def test_create_app_testing_config():
    assert not create_app().testing
    assert create_app({"TESTING": True}).testing
Exemplo n.º 6
0
def test_create_app_override_config():
    app = create_app({"secret_key": "RANXOM"})
    assert app.config["secret_key"] == "RANXOM"