Esempio n. 1
0
def test_key_handler(testdb, use_testdb):
    import terracotta
    from terracotta.handlers import keys

    driver = terracotta.get_driver(str(testdb))

    handler_response = keys.keys()
    assert handler_response
    assert tuple(row['key'] for row in handler_response) == driver.key_names
Esempio n. 2
0
def test_key_handler_env_config(testdb, monkeypatch):
    import terracotta
    from terracotta.handlers import keys

    monkeypatch.setenv('TC_DRIVER_PATH', str(testdb))
    terracotta.update_settings()
    driver = terracotta.get_driver(str(testdb))

    handler_response = keys.keys()
    assert handler_response
    assert tuple(row['key'] for row in handler_response) == driver.key_names
Esempio n. 3
0
def get_keys() -> Response:
    """Get all key names
    ---
    get:
        summary: /keys
        description: List the names and descriptions (if available) of all known keys.
        responses:
            200:
                description: Array containing keys
                schema: KeySchema
    """
    from terracotta.handlers.keys import keys
    schema = KeySchema()
    payload = {'keys': keys()}
    return jsonify(schema.load(payload))