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:
@@ -14,11 +14,11 @@ import datetime
|
|||||||
import itertools
|
import itertools
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
from urllib import parse as urlparse
|
from urllib import parse as urlparse
|
||||||
from webtest.app import AppError
|
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
from oslo_utils import timeutils
|
from oslo_utils import timeutils
|
||||||
|
import webtest.app as webtest_app
|
||||||
from wsme import types as wtypes
|
from wsme import types as wtypes
|
||||||
|
|
||||||
from watcher.api.controllers.v1 import audit_template as api_audit_template
|
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(
|
audit_template_dict = post_get_test_audit_template(
|
||||||
goal=self.fake_goal1.uuid,
|
goal=self.fake_goal1.uuid,
|
||||||
strategy=self.fake_strategy1.uuid, scope=scope)
|
strategy=self.fake_strategy1.uuid, scope=scope)
|
||||||
with self.assertRaisesRegex(AppError,
|
with self.assertRaisesRegex(webtest_app.AppError,
|
||||||
"be included and excluded together"):
|
"be included and excluded together"):
|
||||||
self.post_json('/audit_templates', audit_template_dict)
|
self.post_json('/audit_templates', audit_template_dict)
|
||||||
|
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
# 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 jsonschema
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import jsonschema
|
||||||
|
|
||||||
from watcher.applier.actions import base as baction
|
from watcher.applier.actions import base as baction
|
||||||
from watcher.applier.actions import change_node_power_state
|
from watcher.applier.actions import change_node_power_state
|
||||||
from watcher.common import clients
|
from watcher.common import clients
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
# 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 jsonschema
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import jsonschema
|
||||||
|
|
||||||
from watcher.applier.actions import base as baction
|
from watcher.applier.actions import base as baction
|
||||||
from watcher.applier.actions import change_nova_service_state
|
from watcher.applier.actions import change_nova_service_state
|
||||||
from watcher.common import clients
|
from watcher.common import clients
|
||||||
|
|||||||
@@ -13,9 +13,10 @@
|
|||||||
# 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 jsonschema
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import jsonschema
|
||||||
|
|
||||||
from watcher.applier.actions import base as baction
|
from watcher.applier.actions import base as baction
|
||||||
from watcher.applier.actions import migration
|
from watcher.applier.actions import migration
|
||||||
from watcher.common import clients
|
from watcher.common import clients
|
||||||
|
|||||||
@@ -12,9 +12,10 @@
|
|||||||
# 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 jsonschema
|
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
import jsonschema
|
||||||
|
|
||||||
from watcher.applier.actions import base as baction
|
from watcher.applier.actions import base as baction
|
||||||
from watcher.applier.actions import volume_migration
|
from watcher.applier.actions import volume_migration
|
||||||
from watcher.common import cinder_helper
|
from watcher.common import cinder_helper
|
||||||
|
|||||||
@@ -19,10 +19,10 @@ from unittest import mock
|
|||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_service import service
|
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.cmd import applier
|
||||||
|
from watcher.common import service as watcher_service
|
||||||
from watcher.tests import base
|
from watcher.tests import base
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
# 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 unittest
|
import unittest
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user