'Setup and scan a picture and test plates from event.'

def test_alpr_event_double_call(self, aioclient_mock):

    aioclient_mock.get(self.url, content='image')
    ip.scan(self.hass, entity_id='image_processing.demo_alpr')
    ip.scan(self.hass, entity_id='image_processing.demo_alpr')
    self.hass.block_till_done()
    state = self.hass.states.get('image_processing.demo_alpr')
    assert (len(self.alpr_events) == 4)
    assert (state.state == 'AC3829')
    event_data = [event.data for event in self.alpr_events if (event.data.get('plate') == 'AC3829')]
    assert (len(event_data) == 1)
    assert (event_data[0]['plate'] == 'AC3829')
    assert (event_data[0]['confidence'] == 98.3)
    assert (event_data[0]['entity_id'] == 'image_processing.demo_alpr')
