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: I6cdd4c35a52a014ba3c4dfe4cc2bd4d670c96bc3
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis
2020-04-18 12:01:38 -05:00
parent 12bd9c0590
commit 751027858b
7 changed files with 12 additions and 9 deletions

View File

@@ -14,11 +14,11 @@ import datetime
import itertools
from unittest import mock
from urllib import parse as urlparse
from webtest.app import AppError
from oslo_config import cfg
from oslo_serialization import jsonutils
from oslo_utils import timeutils
import webtest.app as webtest_app
from wsme import types as wtypes
from watcher.api.controllers.v1 import audit_template as api_audit_template
@@ -574,7 +574,7 @@ class TestPost(FunctionalTestWithSetup):
audit_template_dict = post_get_test_audit_template(
goal=self.fake_goal1.uuid,
strategy=self.fake_strategy1.uuid, scope=scope)
with self.assertRaisesRegex(AppError,
with self.assertRaisesRegex(webtest_app.AppError,
"be included and excluded together"):
self.post_json('/audit_templates', audit_template_dict)

View File

@@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import jsonschema
from unittest import mock
import jsonschema
from watcher.applier.actions import base as baction
from watcher.applier.actions import change_node_power_state
from watcher.common import clients

View File

@@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import jsonschema
from unittest import mock
import jsonschema
from watcher.applier.actions import base as baction
from watcher.applier.actions import change_nova_service_state
from watcher.common import clients

View File

@@ -13,9 +13,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import jsonschema
from unittest import mock
import jsonschema
from watcher.applier.actions import base as baction
from watcher.applier.actions import migration
from watcher.common import clients

View File

@@ -12,9 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import jsonschema
from unittest import mock
import jsonschema
from watcher.applier.actions import base as baction
from watcher.applier.actions import volume_migration
from watcher.common import cinder_helper

View File

@@ -19,10 +19,10 @@ from unittest import mock
from oslo_config import cfg
from oslo_service import service
from watcher.applier import sync
from watcher.common import service as watcher_service
from watcher.applier import sync
from watcher.cmd import applier
from watcher.common import service as watcher_service
from watcher.tests import base

View File

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