def test_bad_request(self):
    res_ext = base_extensions.ResourceExtension('tweedles', StubController(response_body))
    manager = StubExtensionManager(res_ext)
    app = compute.APIRouter(manager)
    request = webob.Request.blank('/fake/tweedles')
    request.method = 'POST'
    response = request.get_response(app)
    self.assertEqual(400, response.status_int)
    self.assertEqual('application/json', response.content_type)
    body = jsonutils.loads(response.body)
    expected = {'badRequest': {'message': 'All aboard the fail train!', 'code': 400}}
    self.assertDictMatch(expected, body)
def test_bad_request(self):
    res_ext = base_extensions.ResourceExtension('tweedles', StubController(response_body))
    manager = StubExtensionManager(res_ext)
    app = compute.APIRouter(manager)
    request = webob.Request.blank('/fake/tweedles')
    request.method = 'POST'
    response = request.get_response(app)
    self.assertEqual(400, response.status_int)
    self.assertEqual('application/json', response.content_type)
    body = jsonutils.loads(response.body)
    expected = {'badRequest': {'message': 'All aboard the fail train!', 'code': 400}}
    self.assertDictMatch(expected, body)