Add black code formatter

This commit is contained in:
Sascha Ißbrücker
2024-01-27 11:29:16 +01:00
parent 6775633be5
commit 98b9a9c1a0
128 changed files with 7181 additions and 4264 deletions

View File

@@ -7,23 +7,35 @@ from django.test import TestCase
class AppOptionsTestCase(TestCase):
def setUp(self) -> None:
self.settings_module = importlib.import_module('siteroot.settings.base')
self.settings_module = importlib.import_module("siteroot.settings.base")
def test_empty_csrf_trusted_origins(self):
module = importlib.reload(self.settings_module)
self.assertFalse(hasattr(module, 'CSRF_TRUSTED_ORIGINS'))
self.assertFalse(hasattr(module, "CSRF_TRUSTED_ORIGINS"))
@mock.patch.dict(os.environ, {'LD_CSRF_TRUSTED_ORIGINS': 'https://linkding.example.com'})
@mock.patch.dict(
os.environ, {"LD_CSRF_TRUSTED_ORIGINS": "https://linkding.example.com"}
)
def test_single_csrf_trusted_origin(self):
module = importlib.reload(self.settings_module)
self.assertTrue(hasattr(module, 'CSRF_TRUSTED_ORIGINS'))
self.assertCountEqual(module.CSRF_TRUSTED_ORIGINS, ['https://linkding.example.com'])
self.assertTrue(hasattr(module, "CSRF_TRUSTED_ORIGINS"))
self.assertCountEqual(
module.CSRF_TRUSTED_ORIGINS, ["https://linkding.example.com"]
)
@mock.patch.dict(os.environ, {'LD_CSRF_TRUSTED_ORIGINS': 'https://linkding.example.com,http://linkding.example.com'})
@mock.patch.dict(
os.environ,
{
"LD_CSRF_TRUSTED_ORIGINS": "https://linkding.example.com,http://linkding.example.com"
},
)
def test_multiple_csrf_trusted_origin(self):
module = importlib.reload(self.settings_module)
self.assertTrue(hasattr(module, 'CSRF_TRUSTED_ORIGINS'))
self.assertCountEqual(module.CSRF_TRUSTED_ORIGINS, ['https://linkding.example.com', 'http://linkding.example.com'])
self.assertTrue(hasattr(module, "CSRF_TRUSTED_ORIGINS"))
self.assertCountEqual(
module.CSRF_TRUSTED_ORIGINS,
["https://linkding.example.com", "http://linkding.example.com"],
)