def test_flask_dynaconf(settings):
    """
    Test Flask app wrapped with FlaskDynaconf
    """
    app = Flask(__name__)
    app.config["MY_VAR"] = "foo"
    FlaskDynaconf(app, dynaconf_instance=settings)
    app.config["MY_VAR2"] = "bar"

    assert app.config.HOSTNAME == "host.com"
    assert app.config.MY_VAR == "foo"

    assert app.config["HOSTNAME"] == "host.com"
    assert app.config["MY_VAR"] == "foo"

    assert app.config.get("HOSTNAME") == "host.com"
    assert app.config.get("MY_VAR") == "foo"

    assert app.config("HOSTNAME") == "host.com"
    assert app.config("MY_VAR") == "foo"

    assert "HOSTNAME" in app.config
    assert "MY_VAR" in app.config

    # ref: #521
    assert "NONEXISTENETVAR" not in app.config
    assert ("NONEXISTENETVAR" in app.config) is False

    assert "MY_VAR" in app.config
    assert "MY_VAR2" in app.config
    assert "MY_VAR" in app.config.keys()
    assert "MY_VAR2" in app.config.keys()
    assert ("MY_VAR", "foo") in app.config.items()
    assert ("MY_VAR2", "bar") in app.config.items()
    assert "foo" in app.config.values()
    assert "bar" in app.config.values()
    assert "MY_VAR" in list(app.config)
    assert "MY_VAR2" in list(app.config)
    assert app.config.setdefault("MY_VAR", "default") == "foo"
    assert app.config.setdefault("MY_VAR2", "default") == "bar"
    assert app.config.setdefault("DEFAULT_VAR", "default") == "default"
    assert app.config["DEFAULT_VAR"] == "default"

    with pytest.raises(KeyError):
        app.config["NONEXISTENETVAR"]

    with pytest.raises(AttributeError):
        app.config.nonexistentattribute

    Test Flask app wrapped with FlaskDynaconf
    
tests/test_flask.py