/
test__settings_module.py
35 lines (26 loc) · 1.08 KB
/
test__settings_module.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import os
import unittest
from recipe_scrapers.settings import settings
class SettingsModuleTest(unittest.TestCase):
def test_default_settings(self):
os.environ["RECIPE_SCRAPERS_SETTINGS"] = "recipe_scrapers.settings.default"
self.assertTrue(
len(settings.PLUGINS) > 0,
"There should be some plugins in the default project's settings",
)
self.assertFalse(
settings.SUPPRESS_EXCEPTIONS,
"SUPPRESS_EXCEPTIONS should be set to False in the project's default settings",
)
def test_settings_change_when_new_module_set(self):
self.assertFalse(
settings.SUPPRESS_EXCEPTIONS,
"SUPPRESS_EXCEPTIONS should be set to False in the project's default settings",
)
os.environ[
"RECIPE_SCRAPERS_SETTINGS"
] = "tests.test_data.test_settings_module.test_settings"
self.assertTrue(
settings.SUPPRESS_EXCEPTIONS,
"SUPPRESS_EXCEPTIONS should be set to True after settings are changed with the testing ones",
)