예제 #1
0
파일: test_db.py 프로젝트: poudel/firefly
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)
예제 #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"]
예제 #3
0
파일: test_db.py 프로젝트: poudel/firefly
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)
예제 #4
0
파일: conftest.py 프로젝트: poudel/firefly
def app():
    app = create_app({"TESTING": True})

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

    yield app

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