'Tests that a detailed call can be filtered by changes-since'

def test_get_image_details_with_changes_since(self):

    dt1 = (timeutils.utcnow() - datetime.timedelta(1))
    iso1 = timeutils.isotime(dt1)
    dt2 = (timeutils.utcnow() + datetime.timedelta(1))
    iso2 = timeutils.isotime(dt2)
    dt3 = (timeutils.utcnow() + datetime.timedelta(2))
    dt4 = (timeutils.utcnow() + datetime.timedelta(3))
    iso4 = timeutils.isotime(dt4)
    UUID3 = _gen_uuid()
    extra_fixture = self.get_fixture(id=UUID3, name='fake    image    #3')
    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, name='fake    image    #4', created_at=dt3, updated_at=dt3)
    db_api.image_create(self.context, extra_fixture)
    images = self.client.get_images_detailed(filters={})
    self.assertEqualImages(images, (UUID4, UUID2), unjsonify=False)
    filters = {'changes-since': iso1}
    images = self.client.get_images(filters=filters)
    self.assertEqualImages(images, (UUID4, UUID3, UUID2), unjsonify=False)
    filters = {'changes-since': iso2}
    images = self.client.get_images_detailed(filters=filters)
    self.assertEqualImages(images, (UUID4,), unjsonify=False)
    filters = {'changes-since': iso4}
    images = self.client.get_images(filters=filters)
    self.assertEqualImages(images, (), unjsonify=False)
