Removing dependency on the "mock" package

Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

Also see commit: Ifcaf1c21bea0ec3c35278e49cecc90a101a82113

Change-Id: I58da980351fe14357c210c02eb167a6c0af9d09e
This commit is contained in:
asarfaty 2020-05-10 17:21:14 +02:00
parent e5640f074c
commit 5d2837c83a
65 changed files with 115 additions and 105 deletions

View File

@ -9,7 +9,6 @@ flake8==2.6.2
hacking==1.1.0 hacking==1.1.0
httplib2==0.9.1 httplib2==0.9.1
kombu==4.0.0 kombu==4.0.0
mock==2.0.0
netaddr==0.7.18 netaddr==0.7.18
neutron-lib==2.0.0 neutron-lib==2.0.0
octavia-lib==1.3.1 octavia-lib==1.3.1

View File

@ -29,7 +29,6 @@ oslo.vmware>=2.17.0 # Apache-2.0
PrettyTable<0.8,>=0.7.2 # BSD PrettyTable<0.8,>=0.7.2 # BSD
tooz>=1.58.0 # Apache-2.0 tooz>=1.58.0 # Apache-2.0
decorator>=4.4.1 # BSD decorator>=4.4.1 # BSD
mock>=2.0.0 # BSD
# These repos are installed from git in OpenStack CI if the job # These repos are installed from git in OpenStack CI if the job
# configures them as required-projects: # configures them as required-projects:

View File

@ -7,7 +7,6 @@ coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
flake8>=2.6.0 flake8>=2.6.0
flake8-import-order==0.12 # LGPLv3 flake8-import-order==0.12 # LGPLv3
mock>=2.0.0 # BSD
psycopg2>=2.7 # LGPL/ZPL psycopg2>=2.7 # LGPL/ZPL
PyMySQL>=0.7.6 # MIT License PyMySQL>=0.7.6 # MIT License
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0

View File

@ -13,8 +13,9 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import decorator import decorator
import mock
import netaddr import netaddr
from oslo_config import cfg from oslo_config import cfg
from oslo_db import exception as db_exc from oslo_db import exception as db_exc

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import copy import copy
import time import time
from unittest import mock
import mock
import netaddr import netaddr
from neutron_lib.api.definitions import address_scope from neutron_lib.api.definitions import address_scope

View File

@ -14,7 +14,7 @@
import time import time
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging

View File

@ -17,7 +17,7 @@
import os import os
import time import time
import mock from unittest import mock
from vmware_nsx.api_client import client as nsx_client from vmware_nsx.api_client import client as nsx_client
from vmware_nsx.api_client import eventlet_client from vmware_nsx.api_client import eventlet_client

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron_lib import context from neutron_lib import context
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_vmware import api from oslo_vmware import api

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db
from neutron_lib.db import api as db_api from neutron_lib.db import api as db_api

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
import netaddr import netaddr
from neutron_lib import constants from neutron_lib import constants
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
import webob.exc import webob.exc
from neutron.db import db_base_plugin_v2 from neutron.db import db_base_plugin_v2

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
import webob.exc import webob.exc
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import webob.exc import webob.exc

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests.unit.extensions import test_securitygroup as test_ext_sg from neutron.tests.unit.extensions import test_securitygroup as test_ext_sg

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
import netaddr
import netaddr
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -15,7 +15,7 @@
import copy import copy
import mock from unittest import mock
from neutron_lib.api.definitions import constants as fwaas_consts from neutron_lib.api.definitions import constants as fwaas_consts
from neutron_lib.plugins import directory from neutron_lib.plugins import directory

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
import netaddr
import netaddr
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,8 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants

View File

@ -15,8 +15,8 @@
import copy import copy
import datetime import datetime
from unittest import mock
import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants

View File

@ -13,13 +13,14 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
from oslo_config import cfg
import mock
from neutron.services.flavors import flavors_plugin from neutron.services.flavors import flavors_plugin
from neutron.tests import base from neutron.tests import base
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from oslo_config import cfg
from vmware_nsx.db import nsxv_db from vmware_nsx.db import nsxv_db
from vmware_nsx.services.lbaas import base_mgr from vmware_nsx.services.lbaas import base_mgr

View File

@ -15,7 +15,7 @@
import copy import copy
import mock from unittest import mock
from neutron_lib.plugins import directory from neutron_lib.plugins import directory

View File

@ -12,8 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import mock
from neutron.tests import base from neutron.tests import base
from vmware_nsx.plugins.nsx_v.vshield import vcns_driver from vmware_nsx.plugins.nsx_v.vshield import vcns_driver

View File

@ -12,11 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import mock
from oslo_serialization import jsonutils
from neutron.tests import base from neutron.tests import base
from oslo_serialization import jsonutils
from vmware_nsx.plugins.nsx_v.vshield import nsxv_loadbalancer from vmware_nsx.plugins.nsx_v.vshield import nsxv_loadbalancer
from vmware_nsx.plugins.nsx_v.vshield import vcns from vmware_nsx.plugins.nsx_v.vshield import vcns

View File

@ -16,11 +16,11 @@
import contextlib import contextlib
import copy import copy
import re import re
from unittest import mock
import decorator import decorator
from eventlet import greenthread from eventlet import greenthread
import mock
import netaddr import netaddr
from neutron.db import securitygroups_db as sg_db from neutron.db import securitygroups_db as sg_db
from neutron.extensions import address_scope from neutron.extensions import address_scope

View File

@ -12,16 +12,16 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
from unittest import mock
import mock from neutron.tests.unit import testlib_api
from neutron_lib import constants from neutron_lib import constants
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions as n_exc
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils
from six import moves from six import moves
from neutron.tests.unit import testlib_api
from neutron_lib import exceptions as n_exc
from vmware_nsx.common import config as conf from vmware_nsx.common import config as conf
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc
from vmware_nsx.common import nsxv_constants from vmware_nsx.common import nsxv_constants

View File

@ -12,9 +12,9 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
from eventlet import greenthread from eventlet import greenthread
import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import context as neutron_context from neutron_lib import context as neutron_context

View File

@ -12,8 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib.plugins import constants from neutron_lib.plugins import constants
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -14,8 +14,8 @@
# limitations under the License. # limitations under the License.
import os import os
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from neutron.tests.unit import testlib_api from neutron.tests.unit import testlib_api

View File

@ -13,9 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
import netaddr
import netaddr
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -14,8 +14,7 @@
# under the License. # under the License.
import copy import copy
from unittest import mock
import mock
from neutron_lib.plugins import directory from neutron_lib.plugins import directory

View File

@ -12,8 +12,8 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
import mock
import netaddr import netaddr
from neutron.db import l3_db from neutron.db import l3_db
from neutron.db import models_v2 from neutron.db import models_v2

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
# #
from unittest import mock
import mock
from neutron.tests import base from neutron.tests import base
from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit.api.v2 import test_base

View File

@ -12,12 +12,13 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from unittest import mock
import six
import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import exceptions from neutron_lib import exceptions
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six
from vmware_nsx.api_client import exception as api_exc from vmware_nsx.api_client import exception as api_exc
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc

View File

@ -15,8 +15,8 @@
# #
import hashlib import hashlib
from unittest import mock
import mock
from neutron.tests.unit.api.v2 import test_base from neutron.tests.unit.api.v2 import test_base
from neutron_lib import constants from neutron_lib import constants
from neutron_lib import exceptions from neutron_lib import exceptions

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import re import re
from unittest import mock
import mock
from openstackclient.tests.unit.network.v2 import fakes as network_fakes from openstackclient.tests.unit.network.v2 import fakes as network_fakes
from openstackclient.tests.unit.network.v2 import test_port from openstackclient.tests.unit.network.v2 import test_port
from openstackclient.tests.unit import utils as tests_utils from openstackclient.tests.unit import utils as tests_utils

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import re import re
from unittest import mock
import mock
from openstackclient.tests.unit.network.v2 import test_router from openstackclient.tests.unit.network.v2 import test_router
from openstackclient.tests.unit import utils as tests_utils from openstackclient.tests.unit import utils as tests_utils

View File

@ -14,13 +14,12 @@
# under the License. # under the License.
import re import re
from unittest import mock
import mock
from openstackclient.tests.unit.network.v2 import ( from openstackclient.tests.unit.network.v2 import (
test_security_group_network as test_security_group) test_security_group_network as test_security_group)
from openstackclient.tests.unit import utils as tests_utils from openstackclient.tests.unit import utils as tests_utils
from vmware_nsx.extensions import providersecuritygroup from vmware_nsx.extensions import providersecuritygroup
from vmware_nsx.extensions import securitygrouplogging from vmware_nsx.extensions import securitygrouplogging
from vmware_nsx.extensions import securitygrouppolicy from vmware_nsx.extensions import securitygrouppolicy

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import re import re
from unittest import mock
import mock
from openstackclient.tests.unit.network.v2 import test_subnet from openstackclient.tests.unit.network.v2 import test_subnet
from openstackclient.tests.unit import utils as tests_utils from openstackclient.tests.unit import utils as tests_utils

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import contextlib import contextlib
from unittest import mock
import mock
from neutron.api import extensions from neutron.api import extensions
from neutron_dynamic_routing.db import bgp_db # noqa from neutron_dynamic_routing.db import bgp_db # noqa
from neutron_dynamic_routing import extensions as dr_extensions from neutron_dynamic_routing import extensions as dr_extensions

View File

@ -12,14 +12,11 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import importutils from oslo_utils import importutils
from vmware_nsx.services.flowclassifier.nsx_v import driver as nsx_v_driver
from vmware_nsx.tests import unit as vmware
from vmware_nsx.tests.unit.nsx_v.vshield import fake_vcns
from neutron.api import extensions as api_ext from neutron.api import extensions as api_ext
from neutron.common import config from neutron.common import config
from neutron_lib.api.definitions import portbindings from neutron_lib.api.definitions import portbindings
@ -33,6 +30,10 @@ from networking_sfc.services.flowclassifier.common import exceptions as fc_exc
from networking_sfc.tests import base from networking_sfc.tests import base
from networking_sfc.tests.unit.db import test_flowclassifier_db from networking_sfc.tests.unit.db import test_flowclassifier_db
from vmware_nsx.services.flowclassifier.nsx_v import driver as nsx_v_driver
from vmware_nsx.tests import unit as vmware
from vmware_nsx.tests.unit.nsx_v.vshield import fake_vcns
class TestNsxvFlowClassifierDriver( class TestNsxvFlowClassifierDriver(
test_flowclassifier_db.FlowClassifierDbPluginTestCaseBase, test_flowclassifier_db.FlowClassifierDbPluginTestCaseBase,

View File

@ -12,9 +12,10 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock
import netaddr
from unittest import mock
import netaddr
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,7 +12,8 @@
# implied. # implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock
from unittest import mock
from networking_l2gw.db.l2gateway import l2gateway_db from networking_l2gw.db.l2gateway import l2gateway_db
from networking_l2gw.services.l2gateway.common import config from networking_l2gw.services.l2gateway.common import config

View File

@ -12,13 +12,14 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock
from neutron.tests import base from unittest import mock
from networking_l2gw.db.l2gateway import l2gateway_db from networking_l2gw.db.l2gateway import l2gateway_db
from neutron.tests import base
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc
from vmware_nsx.db import nsxv_db from vmware_nsx.db import nsxv_db
from vmware_nsx.dvs import dvs_utils from vmware_nsx.dvs import dvs_utils

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions as n_exc from neutron_lib import exceptions as n_exc

View File

@ -12,9 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import decorator import decorator
import mock
import testtools import testtools
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,8 +12,8 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from unittest import mock
import mock
import testtools import testtools
from neutron_lib import exceptions from neutron_lib import exceptions

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions from neutron_lib import exceptions

View File

@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from neutron_lib import context from neutron_lib import context
from neutron_lib import exceptions from neutron_lib import exceptions

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import copy import copy
from unittest import mock
import mock
from neutron.services.qos import qos_plugin from neutron.services.qos import qos_plugin
from neutron.tests.unit.services.qos import base from neutron.tests.unit.services.qos import base
from neutron_lib import context from neutron_lib import context
@ -200,11 +200,7 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
# make sure the dvs was updated # make sure the dvs was updated
self.assertTrue(dvs_update_mock.called) self.assertTrue(dvs_update_mock.called)
@mock.patch.object(qos_com_utils, 'update_network_policy_binding') def _test_rule_action_notification(self, action):
@mock.patch.object(dvs.DvsManager, 'update_port_groups_config')
def _test_rule_action_notification(self, action,
dvs_update_mock,
update_bindings_mock):
# Create a policy with a rule # Create a policy with a rule
_policy = QosPolicy( _policy = QosPolicy(
self.ctxt, **self.policy_data['policy']) self.ctxt, **self.policy_data['policy'])
@ -212,9 +208,13 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
# set the rule in the policy data # set the rule in the policy data
setattr(_policy, "rules", [self.rule]) setattr(_policy, "rules", [self.rule])
with mock.patch('neutron.services.qos.qos_plugin.QoSPlugin.' with mock.patch.object(qos_com_utils,
'get_policy', 'update_network_policy_binding'),\
return_value=_policy) as get_rules_mock,\ mock.patch.object(dvs.DvsManager, 'update_port_groups_config'
) as dvs_update_mock,\
mock.patch('neutron.services.qos.qos_plugin.QoSPlugin.'
'get_policy',
return_value=_policy) as get_rules_mock,\
mock.patch.object(QosPolicy, 'get_object', return_value=_policy): mock.patch.object(QosPolicy, 'get_object', return_value=_policy):
# create the network to use this policy # create the network to use this policy
net = self._create_net() net = self._create_net()
@ -265,11 +265,7 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
""" """
self._test_rule_action_notification('delete') self._test_rule_action_notification('delete')
@mock.patch.object(qos_com_utils, 'update_network_policy_binding') def _test_dscp_rule_action_notification(self, action):
@mock.patch.object(dvs.DvsManager, 'update_port_groups_config')
def _test_dscp_rule_action_notification(self, action,
dvs_update_mock,
update_bindings_mock):
# Create a policy with a rule # Create a policy with a rule
_policy = QosPolicy( _policy = QosPolicy(
self.ctxt, **self.policy_data['policy']) self.ctxt, **self.policy_data['policy'])
@ -277,9 +273,13 @@ class TestQosNsxVNotification(test_plugin.NsxVPluginV2TestCase,
# set the rule in the policy data # set the rule in the policy data
setattr(_policy, "rules", [self.dscp_rule]) setattr(_policy, "rules", [self.dscp_rule])
plugin = self.qos_plugin plugin = self.qos_plugin
with mock.patch('neutron.services.qos.qos_plugin.QoSPlugin.' with mock.patch.object(qos_com_utils,
'get_policy', 'update_network_policy_binding'),\
return_value=_policy) as rules_mock,\ mock.patch.object(dvs.DvsManager, 'update_port_groups_config'
) as dvs_update_mock,\
mock.patch('neutron.services.qos.qos_plugin.QoSPlugin.'
'get_policy',
return_value=_policy) as rules_mock,\
mock.patch.object(QosPolicy, 'get_object', mock.patch.object(QosPolicy, 'get_object',
return_value=_policy),\ return_value=_policy),\
mock.patch.object(self.ctxt.session, 'expunge'): mock.patch.object(self.ctxt.session, 'expunge'):

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base

View File

@ -13,10 +13,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from neutron.tests import base from neutron.tests import base
from neutron_lib import context from neutron_lib import context
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import importutils from oslo_utils import importutils

View File

@ -16,8 +16,7 @@
from collections import namedtuple from collections import namedtuple
import contextlib import contextlib
import mock from unittest import mock
from oslo_utils import uuidutils
from neutron.db import l3_db from neutron.db import l3_db
from neutron.db.models import l3 as l3_models from neutron.db.models import l3 as l3_models
@ -26,6 +25,7 @@ from neutron_lib import context as n_ctx
from neutron_lib.plugins import directory from neutron_lib.plugins import directory
from neutron_vpnaas.db.vpn import vpn_models # noqa from neutron_vpnaas.db.vpn import vpn_models # noqa
from neutron_vpnaas.tests import base from neutron_vpnaas.tests import base
from oslo_utils import uuidutils
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc
from vmware_nsx.services.vpnaas.nsxp import ipsec_driver from vmware_nsx.services.vpnaas.nsxp import ipsec_driver

View File

@ -15,9 +15,7 @@
from collections import namedtuple from collections import namedtuple
import contextlib import contextlib
from unittest import mock
import mock
from oslo_utils import uuidutils
from neutron.db import l3_db from neutron.db import l3_db
from neutron.db.models import l3 as l3_models from neutron.db.models import l3 as l3_models
@ -26,6 +24,7 @@ from neutron_lib import context as n_ctx
from neutron_lib.plugins import directory from neutron_lib.plugins import directory
from neutron_vpnaas.db.vpn import vpn_models # noqa from neutron_vpnaas.db.vpn import vpn_models # noqa
from neutron_vpnaas.tests import base from neutron_vpnaas.tests import base
from oslo_utils import uuidutils
from vmware_nsx.common import exceptions as nsx_exc from vmware_nsx.common import exceptions as nsx_exc
from vmware_nsx.services.vpnaas.nsxv3 import ipsec_driver from vmware_nsx.services.vpnaas.nsxv3 import ipsec_driver
@ -726,5 +725,3 @@ class TestVpnaasDriver(test_plugin.NsxV3PluginTestCaseMixin):
self.driver.delete_vpnservice( self.driver.delete_vpnservice(
self.context, FAKE_VPNSERVICE) self.context, FAKE_VPNSERVICE)
delete_service.assert_called_once() delete_service.assert_called_once()
pass

View File

@ -15,7 +15,7 @@
import contextlib import contextlib
import mock from unittest import mock
from neutron_lib.api.definitions import external_net as extnet_apidef from neutron_lib.api.definitions import external_net as extnet_apidef
from neutron_lib import context from neutron_lib import context

View File

@ -15,7 +15,8 @@
import abc import abc
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_log import _options from oslo_log import _options
from oslo_log import log as logging from oslo_log import log as logging
@ -296,7 +297,7 @@ class TestNsxvAdminUtils(AbstractTestAdminUtils,
except SystemExit: except SystemExit:
return return
else: else:
self.assertTrue(False) self.fail()
class TestNsxv3AdminUtils(AbstractTestAdminUtils, class TestNsxv3AdminUtils(AbstractTestAdminUtils,