def _add_test_states(hass):
    'Add multiple states to the db for testing.'
    now = datetime.now()
    five_days_ago = (now - timedelta(days=5))
    eleven_days_ago = (now - timedelta(days=11))
    attributes = {'test_attr': 5, 'test_attr_10': 'nice'}
    hass.block_till_done()
    hass.data[DATA_INSTANCE].block_till_done()
    wait_recording_done(hass)
    with recorder.session_scope(hass=hass) as session:
        for event_id in range(6):
            if (event_id < 2):
                timestamp = eleven_days_ago
                state = 'autopurgeme'
            elif (event_id < 4):
                timestamp = five_days_ago
                state = 'purgeme'
            else:
                timestamp = now
                state = 'dontpurgeme'
            session.add(States(entity_id='test.recorder2', domain='sensor', state=state, attributes=json.dumps(attributes), last_changed=timestamp, last_updated=timestamp, created=timestamp, event_id=(event_id + 1000)))
Add multiple states to the db for testing.
def _add_test_states(hass):
    
    now = datetime.now()
    five_days_ago = (now - timedelta(days=5))
    eleven_days_ago = (now - timedelta(days=11))
    attributes = {'test_attr': 5, 'test_attr_10': 'nice'}
    hass.block_till_done()
    hass.data[DATA_INSTANCE].block_till_done()
    wait_recording_done(hass)
    with recorder.session_scope(hass=hass) as session:
        for event_id in range(6):
            if (event_id < 2):
                timestamp = eleven_days_ago
                state = 'autopurgeme'
            elif (event_id < 4):
                timestamp = five_days_ago
                state = 'purgeme'
            else:
                timestamp = now
                state = 'dontpurgeme'
            session.add(States(entity_id='test.recorder2', domain='sensor', state=state, attributes=json.dumps(attributes), last_changed=timestamp, last_updated=timestamp, created=timestamp, event_id=(event_id + 1000)))