'Ensure qute://history/data returns correct items.'

@pytest.mark.parametrize('start_time_offset,    expected_item_count', [(0, 4), (((24 * 60) * 60), 4), (((48 * 60) * 60), 4), (((72 * 60) * 60), 0)])
def test_qutehistory_data(self, start_time_offset, expected_item_count, now):

    start_time = (now - start_time_offset)
    url = QUrl(('qute://history/data?start_time=' + str(start_time)))
    (_mimetype, data) = qutescheme.qute_history(url)
    items = json.loads(data)
    assert (len(items) == expected_item_count)
    end_time = (start_time - ((24 * 60) * 60))
    for item in items:
        assert (item['time'] <= start_time)
        assert (item['time'] > end_time)
