'We test that missing container/disk format fails with 400 "Bad Request"
:see https://bugs.launchpad.net/glance/+bug/933702'

def _do_test_post_image_content_bad_format(self, format):

    path = '/v1/images'
    (response, content) = self.http.request(path, 'GET')
    self.assertEqual(http_client.OK, response.status)
    images = jsonutils.loads(content)['images']
    self.assertEqual(0, len(images))
    path = '/v1/images'
    headers = minimal_headers('Image1')
    headers[('X-Image-Meta-' + format)] = 'bad_value'
    with tempfile.NamedTemporaryFile() as test_data_file:
        test_data_file.write('XXX')
        test_data_file.flush()
    (response, content) = self.http.request(path, 'POST', headers=headers, body=test_data_file.name)
    self.assertEqual(http_client.BAD_REQUEST, response.status)
    type = format.replace('_format', '')
    expected = ("Invalid    %s    format    'bad_value'    for    image" % type)
    self.assertIn(expected, content, ("Could    not    find    '%s'    in    '%s'" % (expected, content)))
    path = '/v1/images'
    (response, content) = self.http.request(path, 'GET')
    self.assertEqual(http_client.OK, response.status)
    images = jsonutils.loads(content)['images']
    self.assertEqual(0, len(images))
