'Test the event listener against ignored states.'

def test_event_listener_states(self, mock_client):

    self._setup()
    for state_state in (1, 'unknown', '', 'unavailable'):
        state = mock.MagicMock(state=state_state, domain='fake', entity_id='fake.entity-id', object_id='entity', attributes={})
        event = mock.MagicMock(data={'new_state': state}, time_fired=12345)
        body = [{'measurement': 'fake.entity-id', 'tags': {'domain': 'fake', 'entity_id': 'entity'}, 'time': 12345, 'fields': {'value': 1}}]
        self.handler_method(event)
        if (state_state == 1):
            self.assertEqual(mock_client.return_value.write_points.call_count, 1)
            self.assertEqual(mock_client.return_value.write_points.call_args, mock.call(body))
        else:
            self.assertFalse(mock_client.return_value.write_points.called)
        mock_client.return_value.write_points.reset_mock()
