fix tests for device_id

This commit is contained in:
HgO 2022-08-27 14:14:38 +02:00
parent 57a704cd94
commit 0703517f85

View file

@ -54,7 +54,7 @@ class ConfigTestCase(unittest.TestCase):
self.assertEqual("@fakes_user:matrix.example.com", config.user_id)
self.assertEqual("password", config.user_password)
self.assertIsNone(config.user_token)
self.assertEqual("ABCDEFGHIJ", config.device_id)
self.assertIsNone(config.device_id)
self.assertEqual("matrix-alertbot", config.device_name)
self.assertEqual("https://matrix.example.com", config.homeserver_url)
self.assertEqual(["!abcdefgh:matrix.example.com"], config.allowed_rooms)
@ -170,22 +170,6 @@ class ConfigTestCase(unittest.TestCase):
with self.assertRaises(RequiredConfigKeyError):
config._parse_config_values()
@patch("os.path.isdir")
@patch("os.path.exists")
@patch("os.mkdir")
def test_parse_config_with_missing_matrix_device_id(
self, fake_mkdir: Mock, fake_path_exists: Mock, fake_path_isdir: Mock
) -> None:
fake_path_isdir.return_value = False
fake_path_exists.return_value = False
config_path = os.path.join(CONFIG_RESOURCES_DIR, "config.minimal.yml")
config = DummyConfig(config_path)
del config.config_dict["matrix"]["device_id"]
with self.assertRaises(RequiredConfigKeyError):
config._parse_config_values()
@patch("os.path.isdir")
@patch("os.path.exists")
@patch("os.mkdir")