diff options
Diffstat (limited to 'neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py')
-rw-r--r-- | neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py index 0a64ba1090..09d0e942e1 100644 --- a/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py +++ b/neutron/tests/unit/cisco/n1kv/test_n1kv_plugin.py @@ -612,7 +612,7 @@ class TestN1kvNetworkProfiles(N1kvPluginTestCase): net_p['network_profile']['id']) update_req.environ['neutron.context'] = context.Context('', self.tenant_id, - is_admin = True) + is_admin=True) update_res = update_req.get_response(self.ext_api) self.assertEqual(200, update_res.status_int) db_session = db.get_session() @@ -623,7 +623,7 @@ class TestN1kvNetworkProfiles(N1kvPluginTestCase): net_p['network_profile']['id']) self.assertRaises(c_exc.ProfileTenantBindingNotFound, n1kv_db_v2.get_profile_binding, - db_session, 'tenant2', + db_session, 'tenant4', net_p['network_profile']['id']) tenant3 = n1kv_db_v2.get_profile_binding(db_session, 'tenant3', net_p['network_profile']['id']) @@ -637,24 +637,39 @@ class TestN1kvNetworkProfiles(N1kvPluginTestCase): net_p['network_profile']['id']) update_req.environ['neutron.context'] = context.Context('', self.tenant_id, - is_admin = True) + is_admin=True) update_res = update_req.get_response(self.ext_api) self.assertEqual(200, update_res.status_int) # current tenant_id should always present tenant_id = n1kv_db_v2.get_profile_binding(db_session, self.tenant_id, net_p['network_profile']['id']) + self.assertIsNotNone(tenant_id) self.assertRaises(c_exc.ProfileTenantBindingNotFound, n1kv_db_v2.get_profile_binding, db_session, 'tenant1', net_p['network_profile']['id']) self.assertRaises(c_exc.ProfileTenantBindingNotFound, n1kv_db_v2.get_profile_binding, - db_session, 'tenant2', + db_session, 'tenant4', net_p['network_profile']['id']) tenant3 = n1kv_db_v2.get_profile_binding(db_session, 'tenant3', net_p['network_profile']['id']) - self.assertIsNotNone(tenant_id) self.assertIsNotNone(tenant3) + # Add new tenant4 to network profile and make sure existing tenants + # are not deleted. + data = {'network_profile': {c_const.ADD_TENANTS: + ['tenant4']}} + update_req = self.new_update_request('network_profiles', + data, + net_p['network_profile']['id']) + update_req.environ['neutron.context'] = context.Context('', + self.tenant_id, + is_admin=True) + update_res = update_req.get_response(self.ext_api) + self.assertEqual(200, update_res.status_int) + tenant4 = n1kv_db_v2.get_profile_binding(db_session, 'tenant4', + net_p['network_profile']['id']) + self.assertIsNotNone(tenant4) class TestN1kvBasicGet(test_plugin.TestBasicGet, |