this removes Flask, reworks a number of library methods accordingly, and adds generators and build commands to process the instance directory (largely unchanged, except config.py is now config.json) and spit out files suitable to be served by a web server such as Nginx. there are probably some rough edges here, but overall this works. also note, as this is no longer server software on a network, the license has changed from AGPLv3 to GPLv3, and the "or any later version" allowance has been removed Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
39 lines
1.2 KiB
Python
39 lines
1.2 KiB
Python
"""Test basic configuration stuff.
|
|
|
|
SPDX-FileCopyrightText: © 2020 Brian S. Stephan <bss@incorporeal.org>
|
|
SPDX-License-Identifier: GPL-3.0-only
|
|
"""
|
|
import os
|
|
|
|
import pytest
|
|
|
|
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."""
|
|
# this may have gotten here from other imports in other tests
|
|
try:
|
|
delattr(Config, 'INSTANCE_VALUE')
|
|
except AttributeError:
|
|
pass
|
|
|
|
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"
|
|
|
|
|
|
def test_broken_config():
|
|
"""Test that the app initialization errors when not given an instance-looking thing."""
|
|
with pytest.raises(ValueError):
|
|
instance_path = os.path.join(HERE, 'blah')
|
|
init_instance(instance_path=instance_path)
|