From 8b72e8bd5e49ca04dd9fa42f295f35b8fd4e42aa Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 12:01:25 -0500 Subject: [PATCH] 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: I798eb2f2581cfca60c8c59fb35eb69f82cc963c4 Signed-off-by: Sean McGinnis --- test-requirements.txt | 1 - trove_dashboard/content/database_backups/tests.py | 5 ++--- trove_dashboard/content/database_clusters/tests.py | 4 +--- trove_dashboard/content/database_configurations/tests.py | 2 +- trove_dashboard/content/databases/logs/tests.py | 6 ++---- trove_dashboard/content/databases/tests.py | 6 ++---- 6 files changed, 8 insertions(+), 16 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index b461b063..fbdd10d6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,6 @@ hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage>=3.6 ddt>=0.7.0 -mock>=1.2 python-subunit>=0.0.18 selenium>=2.50.1 # Apache-2.0 sphinx>=1.6.2 # BSD diff --git a/trove_dashboard/content/database_backups/tests.py b/trove_dashboard/content/database_backups/tests.py index bfeab311..a694b45f 100644 --- a/trove_dashboard/content/database_backups/tests.py +++ b/trove_dashboard/content/database_backups/tests.py @@ -12,13 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse from django.utils.translation import ugettext_lazy as _ -import mock - from openstack_auth import policy from openstack_dashboard import api as dash_api - from troveclient import common from trove_dashboard import api diff --git a/trove_dashboard/content/database_clusters/tests.py b/trove_dashboard/content/database_clusters/tests.py index 76d2e9f2..6204334a 100644 --- a/trove_dashboard/content/database_clusters/tests.py +++ b/trove_dashboard/content/database_clusters/tests.py @@ -15,11 +15,9 @@ # under the License. import logging +from unittest import mock from django.urls import reverse - -import mock - from openstack_dashboard import api from troveclient import common diff --git a/trove_dashboard/content/database_configurations/tests.py b/trove_dashboard/content/database_configurations/tests.py index 6e208f7a..004fd707 100644 --- a/trove_dashboard/content/database_configurations/tests.py +++ b/trove_dashboard/content/database_configurations/tests.py @@ -13,7 +13,7 @@ # under the License. import logging -import mock +from unittest import mock import django from django.conf import settings diff --git a/trove_dashboard/content/databases/logs/tests.py b/trove_dashboard/content/databases/logs/tests.py index 3f85aca0..b195b421 100644 --- a/trove_dashboard/content/databases/logs/tests.py +++ b/trove_dashboard/content/databases/logs/tests.py @@ -13,17 +13,15 @@ # under the License. import logging +from unittest import mock from django import http from django.urls import reverse - -import mock +from swiftclient import client as swift_client from trove_dashboard import api from trove_dashboard.test import helpers as test -from swiftclient import client as swift_client - LINES = 50 diff --git a/trove_dashboard/content/databases/tests.py b/trove_dashboard/content/databases/tests.py index d40ef5f3..802c31f1 100644 --- a/trove_dashboard/content/databases/tests.py +++ b/trove_dashboard/content/databases/tests.py @@ -14,14 +14,12 @@ # under the License. import logging +import unittest +from unittest import mock import django from django import http from django.urls import reverse -import unittest - -import mock - from horizon import exceptions from openstack_auth import policy from openstack_dashboard import api as dash_api