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)
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"]
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)
def app(): app = create_app({"TESTING": True}) ctx = app.app_context() ctx.push() yield app ctx.pop()
def test_create_app_testing_config(): assert not create_app().testing assert create_app({"TESTING": True}).testing
def test_create_app_override_config(): app = create_app({"secret_key": "RANXOM"}) assert app.config["secret_key"] == "RANXOM"