コード例 #1
0
def test_flags_bool_no_key_prod():
    """Assert that prod with no key initializes, but does not setup the extension."""
    app = Flask(__name__)
    app.config['LD_SDK_KEY'] = None
    app.env = 'production'

    with app.app_context():
        flags = Flags()
        flags.init_app(app)
        on = flags.is_on('bool-flag')

    assert not on
コード例 #2
0
def test_flags_bool():
    """Assert that a boolean (True) is returned, when using the local Flag.json file."""
    app = Flask(__name__)
    app.env = 'development'
    app.config['LD_SDK_KEY'] = 'https://no.flag/avail'

    with app.app_context():
        flags = Flags()
        flags.init_app(app)
        flag_on = flags.is_on('bool-flag')

        assert flag_on