Fix bad typo in cloudpipe.py
Looks like a refactoring problem. we should be raising exc.HTTPBadRequest where exc is in webob. Change-Id: Id6d4e1d43f1d49c05d9da1234e40a603022d35c2
This commit is contained in:
parent
07f5009c9d
commit
e3afd49eef
|
@ -15,6 +15,7 @@
|
|||
"""Connect your vlan to the world."""
|
||||
|
||||
from oslo.config import cfg
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import extensions
|
||||
from nova.api.openstack import wsgi
|
||||
|
@ -148,7 +149,7 @@ class CloudpipeController(object):
|
|||
except exception.NoMoreNetworks:
|
||||
msg = _("Unable to claim IP for VPN instances, ensure it "
|
||||
"isn't running, and try again in a few minutes")
|
||||
raise exception.HTTPBadRequest(explanation=msg)
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
return {'instance_id': instance['uuid']}
|
||||
|
||||
@wsgi.serializers(xml=CloudpipesTemplate)
|
||||
|
|
|
@ -15,10 +15,12 @@
|
|||
|
||||
from lxml import etree
|
||||
from oslo.config import cfg
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack.compute.contrib import cloudpipe
|
||||
from nova.api.openstack import wsgi
|
||||
from nova.compute import utils as compute_utils
|
||||
from nova import exception
|
||||
from nova.openstack.common import timeutils
|
||||
from nova import test
|
||||
from nova.tests.api.openstack import fakes
|
||||
|
@ -115,6 +117,17 @@ class CloudpipeTest(test.NoDBTestCase):
|
|||
response = {'instance_id': 7777}
|
||||
self.assertEqual(res_dict, response)
|
||||
|
||||
def test_cloudpipe_create_no_networks(self):
|
||||
def launch_vpn_instance(context):
|
||||
raise exception.NoMoreNetworks
|
||||
|
||||
self.stubs.Set(self.controller.cloudpipe, 'launch_vpn_instance',
|
||||
launch_vpn_instance)
|
||||
body = {'cloudpipe': {'project_id': 1}}
|
||||
req = fakes.HTTPRequest.blank('/v2/fake/os-cloudpipe')
|
||||
self.assertRaises(exc.HTTPBadRequest,
|
||||
self.controller.create, req, body)
|
||||
|
||||
def test_cloudpipe_create_already_running(self):
|
||||
def launch_vpn_instance(*args, **kwargs):
|
||||
self.fail("Method should not have been called")
|
||||
|
|
Loading…
Reference in New Issue