Exemplo n.º 1
0
	def test_retain_default_true(self):
		settings = {
			"_publish": self.mock,
		}
		config.PERSISTENCE = [persistence.MQTT(**settings)]
		persistence.set("lights/fan", "value")
		call_args = self.mock.single.call_args
		self.assertEqual(call_args[0][0], "lights/fan")
		self.assertEqual(call_args[1]['retain'], True)
Exemplo n.º 2
0
	def test_prefix_slash(self):
		settings = {
			"_publish": self.mock,
			"prefix": "/testname/"
		}
		config.PERSISTENCE = [persistence.MQTT(**settings)]
		persistence.set("lights/fan", "value")
		call_args = self.mock.single.call_args
		self.assertEqual(call_args[0][0], "/testname/lights/fan")
		self.assertEqual(call_args[1]['payload'], "value")
Exemplo n.º 3
0
	def setUp(self):
		self.mock = mock.Mock()
		settings = {
			"_publish": self.mock
		}
		config.PERSISTENCE = [persistence.MQTT(**settings)]