'We test that missing container/disk format only fails with
400 "Bad Request" when the image content is PUT (i.e. not
on the original POST of a queued image).
:see https://bugs.launchpad.net/glance/+bug/937216'

def _do_test_put_image_content_missing_format(self, format):

    path = '/v1/images'
    headers = {'X-Image-Meta-Name': 'Image1', 'X-Image-Meta-Is-Public': 'True'}
    (response, content) = self.http.request(path, 'POST', headers=headers)
    self.assertEqual(http_client.CREATED, response.status)
    data = jsonutils.loads(content)
    image_id = data['image']['id']
    self.addDetail('image_data', testtools.content.json_content(data))
    path = ('/v1/images/%s' % image_id)
    headers = minimal_headers('Image1')
    del headers[('X-Image-Meta-' + format)]
    with tempfile.NamedTemporaryFile() as test_data_file:
        test_data_file.write('XXX')
        test_data_file.flush()
    (response, content) = self.http.request(path, 'PUT', headers=headers, body=test_data_file.name)
    self.assertEqual(http_client.BAD_REQUEST, response.status)
    type = format.replace('_format', '').capitalize()
    expected = ('%s    format    is    not    specified' % type)
    self.assertIn(expected, content, ("Could    not    find    '%s'    in    '%s'" % (expected, content)))
