1
0

Fix lints

This commit is contained in:
Eric Eastwood
2024-05-22 15:01:06 -05:00
parent 3da6bc1902
commit d4b41aaf43
2 changed files with 26 additions and 11 deletions

View File

@@ -43,12 +43,9 @@ from tests.unittest import HomeserverTestCase, override_config
),
],
)
class SendToDeviceTestCaseBase(HomeserverTestCase):
class SendToDeviceTestCase(HomeserverTestCase):
"""
Test `/sendToDevice` will deliver messages across to people receiving them over `/sync`.
In order to run the tests, inherit from this base-class with `HomeserverTestCase`, e.g.
`class SendToDeviceTestCase(SendToDeviceTestCase, HomeserverTestCase)`
"""
servlets = [
@@ -60,9 +57,14 @@ class SendToDeviceTestCaseBase(HomeserverTestCase):
def default_config(self) -> JsonDict:
config = super().default_config()
config["experimental_features"] = self.experimental_features
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
return config
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
# throughout the test cases
self.sync_endpoint: str = self.sync_endpoint
def test_user_to_user(self) -> None:
"""A to-device message from one user to another should get delivered"""

View File

@@ -699,7 +699,7 @@ class SyncCacheTestCase(unittest.HomeserverTestCase):
),
],
)
class DeviceListSyncTestCaseBase(unittest.HomeserverTestCase):
class DeviceListSyncTestCase(unittest.HomeserverTestCase):
"""Tests regarding device list (`device_lists`) changes."""
servlets = [
@@ -712,9 +712,14 @@ class DeviceListSyncTestCaseBase(unittest.HomeserverTestCase):
def default_config(self) -> JsonDict:
config = super().default_config()
config["experimental_features"] = self.experimental_features
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
return config
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
# throughout the test cases
self.sync_endpoint: str = self.sync_endpoint
def test_receiving_local_device_list_changes(self) -> None:
"""Tests that a local users that share a room receive each other's device list
changes.
@@ -901,7 +906,7 @@ class DeviceListSyncTestCaseBase(unittest.HomeserverTestCase):
),
],
)
class DeviceOneTimeKeysSyncTestCaseBase(unittest.HomeserverTestCase):
class DeviceOneTimeKeysSyncTestCase(unittest.HomeserverTestCase):
"""Tests regarding device one time keys (`device_one_time_keys_count`) changes."""
servlets = [
@@ -913,10 +918,14 @@ class DeviceOneTimeKeysSyncTestCaseBase(unittest.HomeserverTestCase):
def default_config(self) -> JsonDict:
config = super().default_config()
config["experimental_features"] = self.experimental_features
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
return config
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
# throughout the test cases
self.sync_endpoint: str = self.sync_endpoint
self.e2e_keys_handler = hs.get_e2e_keys_handler()
def test_no_device_one_time_keys(self) -> None:
@@ -1003,7 +1012,7 @@ class DeviceOneTimeKeysSyncTestCaseBase(unittest.HomeserverTestCase):
),
],
)
class DeviceUnusedFallbackKeySyncTestCaseBase(unittest.HomeserverTestCase):
class DeviceUnusedFallbackKeySyncTestCase(unittest.HomeserverTestCase):
"""Tests regarding device one time keys (`device_unused_fallback_key_types`) changes."""
servlets = [
@@ -1015,10 +1024,14 @@ class DeviceUnusedFallbackKeySyncTestCaseBase(unittest.HomeserverTestCase):
def default_config(self) -> JsonDict:
config = super().default_config()
config["experimental_features"] = self.experimental_features
config["experimental_features"] = self.experimental_features # type: ignore[attr-defined]
return config
def prepare(self, reactor: MemoryReactor, clock: Clock, hs: HomeServer) -> None:
# This pointless re-assignment avoids `# type: ignore[attr-defined]` problems
# throughout the test cases
self.sync_endpoint: str = self.sync_endpoint
self.store = self.hs.get_datastores().main
self.e2e_keys_handler = hs.get_e2e_keys_handler()