'Test the event listener against a blacklist.'

def test_event_listener_blacklist(self, mock_client):

    self._setup()
    for entity_id in ('ok', 'blacklisted'):
        state = mock.MagicMock(state=1, domain='fake', entity_id='fake.{}'.format(entity_id), object_id=entity_id, attributes={})
        event = mock.MagicMock(data={'new_state': state}, time_fired=12345)
        body = [{'measurement': 'fake.{}'.format(entity_id), 'tags': {'domain': 'fake', 'entity_id': entity_id}, 'time': 12345, 'fields': {'value': 1}}]
        self.handler_method(event)
        if (entity_id == 'ok'):
            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()
