Coverage for nlp_webserver/tests/settings_tests.py: 100%
11 statements
« prev ^ index » next coverage.py v7.8.0, created at 2025-08-27 10:34 -0500
« prev ^ index » next coverage.py v7.8.0, created at 2025-08-27 10:34 -0500
1r"""
2crate_anon/nlp_webserver/tests/settings_tests.py
4===============================================================================
6 Copyright (C) 2015, University of Cambridge, Department of Psychiatry.
7 Created by Rudolf Cardinal (rnc1001@cam.ac.uk).
9 This file is part of CRATE.
11 CRATE is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 CRATE is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with CRATE. If not, see <https://www.gnu.org/licenses/>.
24===============================================================================
26Unit testing.
28"""
30import os
31import unittest
33from sqlalchemy import engine_from_config
35from crate_anon.common.constants import EnvVar
36from crate_anon.nlp_webserver.constants import (
37 NlpServerConfigKeys,
38 SQLALCHEMY_COMMON_OPTIONS,
39)
42class NlprpDocgenSettingsTests(unittest.TestCase):
43 @staticmethod
44 def test_docgen_sqlite_settings():
45 # Simulate doc building environment
46 os.environ[EnvVar.GENERATING_CRATE_DOCS] = "True"
47 from crate_anon.nlp_webserver.settings import (
48 SETTINGS,
49 ) # delayed import
51 _ = engine_from_config(
52 SETTINGS,
53 NlpServerConfigKeys.SQLALCHEMY_PREFIX,
54 **SQLALCHEMY_COMMON_OPTIONS
55 )