From 12a0c3b76abd3278a66f57dee431212fb57c57e1 Mon Sep 17 00:00:00 2001 From: tierno Date: Mon, 15 Oct 2018 15:10:36 +0200 Subject: [PATCH] Change at test_RO for test vimconnector Change-Id: Id6b9b674b4286380080f09676bed6e751cfa2164 Signed-off-by: tierno --- osm_ro/vimconn_openstack.py | 2 ++ test/test_RO.py | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/osm_ro/vimconn_openstack.py b/osm_ro/vimconn_openstack.py index 975abafc..b9c4e7c1 100644 --- a/osm_ro/vimconn_openstack.py +++ b/osm_ro/vimconn_openstack.py @@ -353,6 +353,8 @@ class vimconnector(vimconn.vimconnector): raise vimconn.vimconnConnectionException(type(exception).__name__ + ": " + str(exception)) elif isinstance(exception, (nvExceptions.ClientException, ksExceptions.ClientException, neExceptions.NeutronException, nvExceptions.BadRequest)): + if "could not be found" in str(exception): + raise vimconn.vimconnNotFoundException(type(exception).__name__ + ": " + str(exception)) raise vimconn.vimconnUnexpectedResponse(type(exception).__name__ + ": " + str(exception)) elif isinstance(exception, (neExceptions.NetworkNotFoundClient, nvExceptions.NotFound)): raise vimconn.vimconnNotFoundException(type(exception).__name__ + ": " + str(exception)) diff --git a/test/test_RO.py b/test/test_RO.py index 8dddc6f3..e9eca0f6 100755 --- a/test/test_RO.py +++ b/test/test_RO.py @@ -37,7 +37,6 @@ import yaml import sys import time import uuid -import json from argparse import ArgumentParser __author__ = "Pablo Montes, Alfonso Tierno" @@ -696,7 +695,7 @@ class test_vimconn_delete_network(test_base): with self.assertRaises(Exception) as context: test_config["vim_conn"].delete_network(Non_exist_id) - self.assertEqual((context.exception).http_code, 400) + self.assertEqual((context.exception).http_code, 404) class test_vimconn_get_flavor(test_base): @@ -1542,7 +1541,7 @@ def test_vimconnector(args): tenant_name = args.tenant_name test_config['tenant'] = tenant_name - config_params = json.loads(args.config_param) + config_params = yaml.load(args.config_param) org_name = config_params.get('orgname') org_user = config_params.get('user') org_passwd = config_params.get('passwd') @@ -1562,7 +1561,7 @@ def test_vimconnector(args): tenant_name = args.tenant_name test_config['tenant'] = tenant_name - config_params = json.loads(args.config_param) + config_params = yaml.load(args.config_param) os_user = config_params.get('user') os_passwd = config_params.get('passwd') vim_url = args.endpoint_url @@ -1615,7 +1614,7 @@ def test_vimconnector(args): # include all tests for cls in clsmembers: # We exclude 'test_VIM_tenant_operations' unless it is specifically requested by the user - if cls[0].startswith('test_vimconnector'): + if cls[0].startswith('test_vimconn'): code_based_tests.append(cls[1]) logger.debug("tests to be executed: {}".format(code_based_tests)) -- 2.25.1