'Tests that the /images/detail registry API returns list of
images that changed since the time defined by changes-since'

def test_get_details_filter_changes_since(self):

    dt1 = (timeutils.utcnow() - datetime.timedelta(1))
    iso1 = timeutils.isotime(dt1)
    date_only1 = dt1.strftime('%Y-%m-%d')
    date_only2 = dt1.strftime('%Y%m%d')
    date_only3 = dt1.strftime('%Y-%m%d')
    dt2 = (timeutils.utcnow() + datetime.timedelta(1))
    iso2 = timeutils.isotime(dt2)
    image_ts = (timeutils.utcnow() + datetime.timedelta(2))
    hour_before = image_ts.strftime('%Y-%m-%dT%H:%M:%S%%2B01:00')
    hour_after = image_ts.strftime('%Y-%m-%dT%H:%M:%S-01:00')
    dt4 = (timeutils.utcnow() + datetime.timedelta(3))
    iso4 = timeutils.isotime(dt4)
    UUID3 = _gen_uuid()
    extra_fixture = self.get_fixture(id=UUID3, size=18)
    db_api.image_create(self.context, extra_fixture)
    db_api.image_destroy(self.context, UUID3)
    UUID4 = _gen_uuid()
    extra_fixture = self.get_fixture(id=UUID4, disk_format='ami', container_format='ami', created_at=image_ts, updated_at=image_ts)
    db_api.image_create(self.context, extra_fixture)
    res = self.get_api_response_ext(http.OK, url='/images/detail')
    self.assertEqualImages(res, (UUID4, UUID2))
    res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % iso1))
    self.assertEqualImages(res, (UUID4, UUID3, UUID2))
    res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % iso2))
    self.assertEqualImages(res, (UUID4,))
    res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % hour_before))
    self.assertEqualImages(res, (UUID4,))
    res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % hour_after))
    self.assertEqualImages(res, ())
    res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % iso4))
    self.assertEqualImages(res, ())
    for param in [date_only1, date_only2, date_only3]:
        res = self.get_api_response_ext(http.OK, url=('/images/detail?changes-since=%s' % param))
        self.assertEqualImages(res, (UUID4, UUID3, UUID2))
    self.get_api_response_ext(http.BAD_REQUEST, url='/images/detail?changes-since=')
