"""Test basic configuration stuff.

SPDX-FileCopyrightText: © 2020 Brian S. Stephan <bss@incorporeal.org>
SPDX-License-Identifier: AGPL-3.0-or-later
"""
import os

from incorporealcms import init_instance
from incorporealcms.config import Config

HERE = os.path.dirname(os.path.abspath(__file__))


def test_config():
    """Test that the app initialization sets values not normally present in the config."""
    assert not getattr(Config, 'INSTANCE_VALUE', None)
    assert not getattr(Config, 'EXTRA_VALUE', None)

    instance_path = os.path.join(HERE, 'instance')
    init_instance(instance_path=instance_path, extra_config={"EXTRA_VALUE": "hello"})

    assert getattr(Config, 'INSTANCE_VALUE', None) == "hi"
    assert getattr(Config, 'EXTRA_VALUE', None) == "hello"