Merge "Fix incorrect NotImplementedError"

This commit is contained in:
Jenkins 2013-09-13 08:08:18 +00:00 committed by Gerrit Code Review
commit 3f9fe8f6a5
3 changed files with 14 additions and 7 deletions

View File

@ -271,7 +271,7 @@ class RouterPluginBase(object):
pass
def get_routers_count(self, context, filters=None):
raise qexception.NotImplementedError()
raise NotImplementedError()
def get_floatingips_count(self, context, filters=None):
raise qexception.NotImplementedError()
raise NotImplementedError()

View File

@ -1092,11 +1092,9 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
def update_network(self, context, id, network):
pnet._raise_if_updates_provider_attributes(network['network'])
if network["network"].get("admin_state_up"):
if network['network']["admin_state_up"] is False:
raise q_exc.NotImplementedError(_("admin_state_up=False "
"networks are not "
"supported."))
if network["network"].get("admin_state_up") is False:
raise NotImplementedError(_("admin_state_up=False networks "
"are not supported."))
with context.session.begin(subtransactions=True):
net = super(NvpPluginV2, self).update_network(context, id, network)
if psec.PORTSECURITY in network['network']:

View File

@ -362,6 +362,15 @@ class TestNiciraNetworksV2(test_plugin.TestNetworksV2,
self.assertEqual(webob.exc.HTTPServiceUnavailable.code,
res.status_int)
def test_update_network_with_admin_false(self):
data = {'network': {'admin_state_up': False}}
with self.network() as net:
plugin = manager.NeutronManager.get_plugin()
self.assertRaises(NotImplementedError,
plugin.update_network,
context.get_admin_context(),
net['network']['id'], data)
class NiciraPortSecurityTestCase(psec.PortSecurityDBTestCase):