22import unittest
33import mock
44import mqtt
5+ import msg_queue
56
67
78class MQTTTest (unittest .TestCase ):
@@ -40,10 +41,10 @@ def test_connect_fails_mqtt_error(self, config_mock, mqtt_mock):
4041 with self .assertRaises (ValueError ):
4142 mqtt .connect ()
4243
43- @mock .patch .object (mqtt , "link_handler" )
44+
45+ """ @mock.patch.object(msg_queue, "link_handler")
4446 @mock.patch.object(mqtt, "load_config")
4547 def test_on_message_success(self, config_mock, link_mock):
46- """Tests on_message for success."""
4748 config_mock.return_value = {"domain_prefix": "_ffmuc_"}
4849 link_mock.return_value = dict(WireGuard="result")
4950 mqtt_msg = mock.patch.object(mqtt.mqtt, "MQTTMessage")
@@ -53,18 +54,17 @@ def test_on_message_success(self, config_mock, link_mock):
5354 link_mock.assert_has_calls(
5455 [
5556 mock.call(
56- mqtt .WireGuardClient (
57+ msg_queue .WireGuardClient(
5758 public_key="PUB_KEY", domain="domain1", remove=False
5859 )
5960 )
6061 ],
6162 any_order=True,
6263 )
6364
64- @mock .patch .object (mqtt , "link_handler" )
65+ @mock.patch.object(msg_queue , "link_handler")
6566 @mock.patch.object(mqtt, "load_config")
6667 def test_on_message_fails_no_domain(self, config_mock, link_mock):
67- """Tests on_message for failure to parse domain."""
6868 config_mock.return_value = {
6969 "domain_prefix": "ffmuc_",
7070 "log_level": "DEBUG",
@@ -83,7 +83,7 @@ def test_on_message_fails_no_domain(self, config_mock, link_mock):
8383 mqtt_msg.topic = "bad_domain_match"
8484 with self.assertRaises(ValueError):
8585 mqtt.on_message(None, None, mqtt_msg)
86-
86+ """
8787
8888if __name__ == "__main__" :
8989 unittest .main ()
0 commit comments