Ejemplo n.º 1
0
 def test_callback_exception(self):
     """Test gateway callback with exception."""
     side_effect = ValueError('test')
     self.gateway = my.Gateway(event_callback=self._callback)
     with mock.patch.object(self.gateway,
                            'event_callback',
                            side_effect=side_effect) as mock_callback:
         with self.assertLogs(level='ERROR') as test_handle:
             self.gateway.alert(1)
         assert mock_callback.called
         self.assertEqual(
             # only check first line of error log
             test_handle.output[0].split('\n', 1)[0],
             'ERROR:mysensors.mysensors:test')
Ejemplo n.º 2
0
 def setUp(self):
     self.gw = my.Gateway()
Ejemplo n.º 3
0
 def setUp(self):
     """Setup gateway."""
     self.gateway = my.Gateway()
Ejemplo n.º 4
0
 def setUp(self):
     """Setup gateway."""
     self.gateway = my.Gateway(protocol_version='2.0')
Ejemplo n.º 5
0
 def test_persistence_at_init(self, mock_load_sensors):
     """Test call to load persistence_file at init of Gateway."""
     self.gateway = my.Gateway(persistence=True)
     assert mock_load_sensors.called