def test_subscribe(self): fake_hass = mock.MagicMock() gf = graphite.GraphiteFeeder(fake_hass, 'foo', 123, 'ha') fake_hass.bus.listen_once.has_calls([ mock.call(EVENT_HOMEASSISTANT_START, gf.start_listen), mock.call(EVENT_HOMEASSISTANT_STOP, gf.shutdown), ]) fake_hass.bus.listen.assert_called_once_with(EVENT_STATE_CHANGED, gf.event_listener)
def test_subscribe(self): """Test the subscription.""" fake_hass = mock.MagicMock() gf = graphite.GraphiteFeeder(fake_hass, 'foo', 123, 'ha') fake_hass.bus.listen_once.has_calls([ mock.call(EVENT_HOMEASSISTANT_START, gf.start_listen), mock.call(EVENT_HOMEASSISTANT_STOP, gf.shutdown), ]) self.assertEqual(fake_hass.bus.listen.call_count, 1) self.assertEqual(fake_hass.bus.listen.call_args, mock.call(EVENT_STATE_CHANGED, gf.event_listener))
def test_subscribe(self): """Test the subscription.""" fake_hass = mock.MagicMock() gf = graphite.GraphiteFeeder(fake_hass, "foo", 123, "ha") fake_hass.bus.listen_once.has_calls([ mock.call(EVENT_HOMEASSISTANT_START, gf.start_listen), mock.call(EVENT_HOMEASSISTANT_STOP, gf.shutdown), ]) assert fake_hass.bus.listen.call_count == 1 assert fake_hass.bus.listen.call_args == mock.call( EVENT_STATE_CHANGED, gf.event_listener)
def setup_method(self, method): """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() self.gf = graphite.GraphiteFeeder(self.hass, 'foo', 123, 'ha')
def setup_method(self, method): """Setup things to be run when tests are started.""" self.hass = get_test_home_assistant() self.hass.config.latitude = 32.87336 self.hass.config.longitude = 117.22743 self.gf = graphite.GraphiteFeeder(self.hass, 'foo', 123, 'ha')
def setup_method(self, method): self.hass = get_test_home_assistant() self.hass.config.latitude = 32.87336 self.hass.config.longitude = 117.22743 self.gf = graphite.GraphiteFeeder(self.hass, 'foo', 123, 'ha')