def test_default_tenant_replace(self): ctx = context.get_admin_context() ctx.tenant_id = "d434dd90-76ec-11e2-bcfd-0800200c9a66" test_profile_id = "AAAAAAAA-76ec-11e2-bcfd-0800200c9a66" test_profile_type = "policy" n1kv_db_v2.create_profile_binding(self.session, cisco_constants.TENANT_ID_NOT_SET, test_profile_id, test_profile_type) network_profile = {"network_profile": TEST_NETWORK_PROFILE} self.create_network_profile(ctx, network_profile) binding = n1kv_db_v2.get_profile_binding(self.session, ctx.tenant_id, test_profile_id) self.assertIsNone( n1kv_db_v2.get_profile_binding(self.session, cisco_constants.TENANT_ID_NOT_SET, test_profile_id)) self.assertNotEqual(binding.tenant_id, cisco_constants.TENANT_ID_NOT_SET)
def test_get_profile_binding(self): test_tenant_id = "d434dd90-76ec-11e2-bcfd-0800200c9a66" test_profile_id = "dd7b9741-76ec-11e2-bcfd-0800200c9a66" test_profile_type = "network" self._create_test_binding_if_not_there(test_tenant_id, test_profile_id, test_profile_type) binding = n1kv_db_v2.get_profile_binding(self.session, test_tenant_id, test_profile_id) self.assertEqual(binding.tenant_id, test_tenant_id) self.assertEqual(binding.profile_id, test_profile_id) self.assertEqual(binding.profile_type, test_profile_type)
def test_default_tenant_replace(self): ctx = context.get_admin_context() ctx.tenant_id = "d434dd90-76ec-11e2-bcfd-0800200c9a66" test_profile_id = "AAAAAAAA-76ec-11e2-bcfd-0800200c9a66" test_profile_type = "policy" n1kv_db_v2.create_profile_binding(cisco_constants.TENANT_ID_NOT_SET, test_profile_id, test_profile_type) network_profile = {"network_profile": TEST_NETWORK_PROFILE} test_network_profile = self.create_network_profile(ctx, network_profile) binding = n1kv_db_v2.get_profile_binding(ctx.tenant_id, test_profile_id) self.assertIsNone(n1kv_db_v2.get_profile_binding( cisco_constants.TENANT_ID_NOT_SET, test_profile_id)) self.assertNotEqual(binding.tenant_id, cisco_constants.TENANT_ID_NOT_SET) n1kv_db_v2.delete_network_profile(self.session, test_network_profile['id'])
def test_default_tenant_replace(self): ctx = context.get_admin_context() ctx.tenant_id = "d434dd90-76ec-11e2-bcfd-0800200c9a66" test_profile_id = "AAAAAAAA-76ec-11e2-bcfd-0800200c9a66" test_profile_type = "policy" n1kv_db_v2.create_profile_binding( self.session, cisco_constants.TENANT_ID_NOT_SET, test_profile_id, test_profile_type ) network_profile = {"network_profile": TEST_NETWORK_PROFILE} self.create_network_profile(ctx, network_profile) binding = n1kv_db_v2.get_profile_binding(self.session, ctx.tenant_id, test_profile_id) self.assertRaises( c_exc.ProfileTenantBindingNotFound, n1kv_db_v2.get_profile_binding, self.session, cisco_constants.TENANT_ID_NOT_SET, test_profile_id, ) self.assertNotEqual(binding.tenant_id, cisco_constants.TENANT_ID_NOT_SET)