Use unittest.mock instead of third party mock

Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I8f764e9ba46a4e2055be61eb0fe97d155ab1c70e
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 11:52:52 -05:00
parent 368fdfff42
commit fd6cf83554
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
234 changed files with 296 additions and 259 deletions
contrib/heat_docker/heat_docker/tests
heat/tests
api
autoscaling
aws
clients
constraints
convergence/framework
db
engine
fakes.py
openstack

@ -14,9 +14,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
import random
import string
from unittest import mock
class APIError(Exception):

@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common.i18n import _

@ -13,7 +13,7 @@
import json
import mock
from unittest import mock
from oslo_config import cfg
from oslo_utils import importutils

@ -13,8 +13,8 @@
import json
import os
from unittest import mock
import mock
from oslo_config import fixture as config_fixture
from heat.api.aws import exception

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
import webob.exc
import heat.api.middleware.fault as fault

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import heat.api.middleware.fault as fault
import heat.api.openstack.v1.build_info as build_info

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import webob.exc
import heat.api.middleware.fault as fault

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import webob.exc
import heat.api.middleware.fault as fault

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

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
import webob.exc
import heat.api.middleware.fault as fault

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
import webob.exc
import heat.api.middleware.fault as fault

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
from oslo_config import cfg
import webob.exc

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from webob import exc
from heat.api.openstack.v1 import util

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from urllib import parse as urlparse
from heat.api.openstack.v1.views import views_common

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.api.openstack.v1.views import stacks_view
from heat.common import identifier

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_log import log
from oslo_messaging._drivers import common as rpc_common

@ -15,14 +15,14 @@
# under the License.
from unittest import mock
import fixtures
import json
import mock
from oslo_config import cfg
import socket
import webob
from oslo_config import cfg
from heat.api.aws import exception as aws_exception
from heat.common import exception
from heat.common import wsgi

@ -12,8 +12,8 @@
import datetime
import json
from unittest import mock
import mock
from oslo_utils import timeutils
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import short_id

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -13,8 +13,8 @@
import datetime
import json
from unittest import mock
import mock
from oslo_utils import timeutils
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -12,8 +12,8 @@
# under the License.
import copy
from unittest import mock
import mock
from neutronclient.common import exceptions as q_exceptions
from neutronclient.v2_0 import client as neutronclient

@ -12,9 +12,9 @@
# under the License.
import copy
from unittest import mock
import uuid
import mock
from neutronclient.v2_0 import client as neutronclient
from heat.common import exception

@ -12,8 +12,8 @@
# under the License.
import copy
from unittest import mock
import mock
from oslo_config import cfg
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
import swiftclient.client as sc

@ -13,8 +13,8 @@
import collections
import copy
from unittest import mock
import mock
from neutronclient.common import exceptions as neutron_exc
from neutronclient.v2_0 import client as neutronclient

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from heat.common import exception

@ -12,9 +12,9 @@
# under the License.
import copy
from unittest import mock
from cinderclient import exceptions as cinder_exp
import mock
from oslo_config import cfg
from heat.common import exception

@ -14,9 +14,9 @@
import copy
import datetime
import json
from unittest import mock
import uuid
import mock
from oslo_utils import timeutils
from urllib import parse

@ -12,9 +12,9 @@
# under the License.
import collections
from unittest import mock
from barbicanclient import exceptions
import mock
from heat.common import exception
from heat.engine.clients.os import barbican

@ -11,9 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from heat.tests import common
from heat.tests import utils
import mock
class BlazarClientPluginTest(common.HeatTestCase):

@ -12,11 +12,11 @@
# under the License.
"""Tests for :module:'heat.engine.clients.os.cinder'."""
from unittest import mock
import uuid
from cinderclient import exceptions as cinder_exc
from keystoneauth1 import exceptions as ks_exceptions
import mock
from heat.common import exception
from heat.engine.clients.os import cinder

@ -11,6 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from aodhclient import exceptions as aodh_exc
from cinderclient import exceptions as cinder_exc
from glanceclient import exc as glance_exc
@ -20,7 +22,6 @@ from keystoneauth1 import exceptions as keystone_exc
from keystoneauth1.identity import generic
from manilaclient import exceptions as manila_exc
from mistralclient.api import base as mistral_base
import mock
from neutronclient.common import exceptions as neutron_exc
from openstack import exceptions
from oslo_config import cfg

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from designateclient import client as designate_client
import mock
from heat.common import exception as heat_exception
from heat.engine.clients.os import designate as client

@ -11,10 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
from glanceclient import exc
import mock
from heat.engine.clients import client_exception as exception
from heat.engine.clients.os import glance

@ -12,7 +12,7 @@
# under the License.
import json
import mock
from unittest import mock
import uuid
from keystoneauth1 import access as ks_access

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from ironicclient import exceptions as ic_exc
import mock
from heat.engine.clients.os import ironic as ic
from heat.tests import common

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from keystoneauth1 import exceptions as keystone_exceptions
import mock
from heat.common import exception
from heat.engine.clients.os import keystone

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from magnumclient import exceptions as mc_exc
import mock
from heat.engine.clients.os import magnum as mc
from heat.tests import common

@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
from unittest import mock
from manilaclient import exceptions
import mock
from heat.common import exception as heat_exception
from heat.tests import common

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from mistralclient.auth import keystone
import mock
from heat.common import exception
from heat.engine.clients.os import mistral

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception as heat_exception
from heat.engine.clients.os import monasca as client_plugin

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from neutronclient.common import exceptions as qe
from heat.common import exception

@ -13,9 +13,9 @@
"""Tests for :module:'heat.engine.clients.os.nova'."""
import collections
from unittest import mock
import uuid
import mock
from novaclient import client as nc
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg

@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import mock
from saharaclient.api import base as sahara_base
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from openstack import exceptions

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from openstack import exceptions
from heat.engine.clients.os import senlin as senlin_plugin

@ -12,8 +12,8 @@
# under the License.
import datetime
from unittest import mock
import mock
import pytz
from testtools import matchers

@ -11,10 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.engine.clients.os import zaqar
from heat.tests import common
from heat.tests import utils

@ -10,7 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.tests import common
from heat.tests import utils

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.engine.constraint import common_constraints as cc
from heat.tests import common

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.engine import worker
from heat.tests.convergence.framework import message_processor

@ -13,20 +13,19 @@
import copy
import datetime
import fixtures
import json
import logging
import time
from unittest import mock
import uuid
import mock
import fixtures
from oslo_config import cfg
from oslo_db import exception as db_exception
from oslo_utils import timeutils
from sqlalchemy.orm import exc
from sqlalchemy.orm import session
from heat.common import context
from heat.common import exception
from heat.common import short_id

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.db.sqlalchemy import filters as db_filters
from heat.tests import common

@ -12,8 +12,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from oslo_config import cfg
from oslo_utils import timeutils

@ -12,9 +12,9 @@
# under the License.
import datetime
from unittest import mock
import uuid
import mock
from oslo_messaging.rpc import dispatcher
from oslo_serialization import jsonutils as json
from oslo_utils import timeutils

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_messaging.rpc import dispatcher
from heat.common import exception

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_messaging.rpc import dispatcher

@ -11,7 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_messaging.rpc import dispatcher
from oslo_service import threadgroup

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_messaging.rpc import dispatcher
from oslo_utils import timeutils

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

@ -10,7 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_messaging.rpc import dispatcher

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import mock
from oslo_messaging.rpc import dispatcher
from heat.common import exception

@ -10,10 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import eventlet.queue
import mock
from oslo_config import cfg
from oslo_messaging import conffixture
from oslo_messaging.rpc import dispatcher

@ -11,9 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import eventlet
import mock
from unittest import mock
import eventlet
from oslo_context import context
from heat.engine import service

@ -13,10 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import eventlet
import mock
from unittest import mock
import uuid
import eventlet
from oslo_config import cfg
from heat.common import exception

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from heat.db.sqlalchemy import api as db_api
from heat.engine import check_resource

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.engine import environment

@ -13,9 +13,9 @@
import contextlib
import itertools
from unittest import mock
import eventlet
import mock
from heat.common import timeutils
from heat.engine import dependencies

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from oslo_db import exception
from heat.engine import sync_point

@ -18,8 +18,9 @@ wrong the tests might raise AssertionError. I've indicated in comments the
places where actual behavior differs from the spec.
"""
from unittest import mock
from keystoneauth1 import plugin
import mock
class FakeClient(object):

@ -14,8 +14,7 @@
import copy
import json
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -12,8 +12,7 @@
# under the License.
import copy
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from blazarclient import exception as client_exception
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from heat.common import exception

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from blazarclient import exception as client_exception
import mock
from oslo_utils.fixture import uuidsentinel as uuids
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.engine.clients.os import cinder as c_plugin
from heat.engine.resources.openstack.cinder import qos_specs

@ -10,7 +10,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.common import template_format

@ -14,9 +14,9 @@
import collections
import copy
import json
from unittest import mock
from cinderclient import exceptions as cinder_exp
import mock
from oslo_config import cfg
from heat.common import exception

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
import mock
from unittest import mock
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.engine.clients.os import cinder as c_plugin

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from cinderclient.v2 import client as cinderclient
import mock
from heat.engine.clients.os import cinder
from heat.engine.clients.os import nova

@ -11,8 +11,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
from designateclient import exceptions as designate_exception
import mock
from heat.common import exception
from heat.engine.resources.openstack.designate import recordset

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import exception
from heat.engine.resources.openstack.designate import zone

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from glanceclient import exc
from heat.common import exception

@ -11,10 +11,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import yaml
import mock
from heat.engine import stack
from heat.engine import template

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

@ -12,8 +12,7 @@
# under the License.
import copy
import mock
from unittest import mock
from heat.common import exception
from heat.common import grouputils

@ -12,8 +12,8 @@
# under the License.
import json
from unittest import mock
import mock
from heat.common import exception
from heat.common import template_format

@ -13,10 +13,9 @@
import contextlib
import email
from unittest import mock
import uuid
import mock
from heat.common import exception as exc
from heat.engine import stack as parser
from heat.engine import template

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from heat.common import template_format
from heat.engine import resource

@ -12,8 +12,8 @@
# under the License.
import re
from unittest import mock
import mock
from testtools import matchers
from heat.common import exception

@ -13,11 +13,11 @@
import collections
import json
from unittest import mock
from heatclient import exc
from heatclient.v1 import stacks
from keystoneauth1 import loading as ks_loading
import mock
from oslo_config import cfg
from heat.common import exception

@ -12,7 +12,7 @@
# under the License.
import copy
import mock
from unittest import mock
from heat.common import exception
from heat.engine import node_data

@ -12,8 +12,7 @@
# under the License.
import copy
import mock
from unittest import mock
from heat.common import exception
from heat.common import grouputils

Some files were not shown because too many files have changed in this diff Show More