Пример #1
0
def test_get_token(fx_token_store):
    app.config['TOKEN_STORE'] = fx_token_store
    with app.app_context():
        token_store = get_token_store()
        assert isinstance(token_store, BaseCache)
        token_store.add('abc', 123)
        assert fx_token_store.get('abc') == 123
        token_store.set('def', 456)
        assert fx_token_store.get('def') == 456
        token_store.inc('def')
        assert fx_token_store.get('def') == 457
        token_store.dec('abc')
        assert fx_token_store.get('abc') == 122
        token_store.delete('def')
        assert not fx_token_store.get('def')
Пример #2
0
def test_get_token(fx_token_store):
    app.config['TOKEN_STORE'] = fx_token_store
    with app.app_context():
        token_store = get_token_store()
        assert isinstance(token_store, BaseCache)
        token_store.add('abc', 123)
        assert fx_token_store.get('abc') == 123
        token_store.set('def', 456)
        assert fx_token_store.get('def') == 456
        token_store.inc('def')
        assert fx_token_store.get('def') == 457
        token_store.dec('abc')
        assert fx_token_store.get('abc') == 122
        token_store.delete('def')
        assert not fx_token_store.get('def')
Пример #3
0
def test_get_token(fx_token_store):
    app.config["TOKEN_STORE"] = fx_token_store
    with app.app_context():
        token_store = get_token_store()
        assert isinstance(token_store, BaseCache)
        token_store.add("abc", 123)
        assert fx_token_store.get("abc") == 123
        token_store.set("def", 456)
        assert fx_token_store.get("def") == 456
        token_store.inc("def")
        assert fx_token_store.get("def") == 457
        token_store.dec("abc")
        assert fx_token_store.get("abc") == 122
        token_store.delete("def")
        assert not fx_token_store.get("def")
Пример #4
0
def test_get_token_store__invalid_type():
    app.config['TOKEN_STORE'] = 'invalid type'
    with raises(RuntimeError):
        with app.app_context():
            get_token_store()
Пример #5
0
def test_get_token_store__no_config():
    with raises(RuntimeError):
        with app.app_context():
            get_token_store()
Пример #6
0
def test_get_token_store__invalid_type():
    app.config['TOKEN_STORE'] = 'invalid type'
    with raises(RuntimeError):
        with app.app_context():
            get_token_store()
Пример #7
0
def test_get_token_store__no_config():
    with raises(RuntimeError):
        with app.app_context():
            get_token_store()