mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-09 11:02:43 -04:00
Add missing type hints to tests.config. (#14681)
This commit is contained in:
parent
864c3f85b0
commit
3aeca2588b
18 changed files with 108 additions and 103 deletions
|
@ -24,13 +24,13 @@ from tests import unittest
|
|||
|
||||
|
||||
class BaseConfigTestCase(unittest.TestCase):
|
||||
def setUp(self):
|
||||
def setUp(self) -> None:
|
||||
# The root object needs a server property with a public_baseurl.
|
||||
root = Mock()
|
||||
root.server.public_baseurl = "http://test"
|
||||
self.config = Config(root)
|
||||
|
||||
def test_loading_missing_templates(self):
|
||||
def test_loading_missing_templates(self) -> None:
|
||||
# Use a temporary directory that exists on the system, but that isn't likely to
|
||||
# contain template files
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
|
@ -50,7 +50,7 @@ class BaseConfigTestCase(unittest.TestCase):
|
|||
"Template file did not contain our test string",
|
||||
)
|
||||
|
||||
def test_loading_custom_templates(self):
|
||||
def test_loading_custom_templates(self) -> None:
|
||||
# Use a temporary directory that exists on the system
|
||||
with tempfile.TemporaryDirectory() as tmp_dir:
|
||||
# Create a temporary bogus template file
|
||||
|
@ -79,7 +79,7 @@ class BaseConfigTestCase(unittest.TestCase):
|
|||
"Template file did not contain our test string",
|
||||
)
|
||||
|
||||
def test_multiple_custom_template_directories(self):
|
||||
def test_multiple_custom_template_directories(self) -> None:
|
||||
"""Tests that directories are searched in the right order if multiple custom
|
||||
template directories are provided.
|
||||
"""
|
||||
|
@ -137,7 +137,7 @@ class BaseConfigTestCase(unittest.TestCase):
|
|||
for td in tempdirs:
|
||||
td.cleanup()
|
||||
|
||||
def test_loading_template_from_nonexistent_custom_directory(self):
|
||||
def test_loading_template_from_nonexistent_custom_directory(self) -> None:
|
||||
with self.assertRaises(ConfigError):
|
||||
self.config.read_templates(
|
||||
["some_filename.html"], ("a_nonexistent_directory",)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue