From 5e5b821105168336160d91625d1ef7e741d1b3e8 Mon Sep 17 00:00:00 2001
From: Chenxiong Qi <cqi@redhat.com>
Date: Feb 27 2020 11:14:42 +0000
Subject: Use unittest.mock


unittest.mock is included in Python 3, no need to install mock
separately.

Signed-off-by: Chenxiong Qi <cqi@redhat.com>

---

diff --git a/dev_scripts/find_images_to_rebuild.py b/dev_scripts/find_images_to_rebuild.py
index 30bd4ca..7869169 100755
--- a/dev_scripts/find_images_to_rebuild.py
+++ b/dev_scripts/find_images_to_rebuild.py
@@ -3,7 +3,7 @@ from __future__ import print_function
 import os
 import sys
 from pprint import pprint
-from mock import patch
+from unittest.mock import patch
 from logging.config import dictConfig
 import fedmsg.config
 
diff --git a/test-requirements.txt b/test-requirements.txt
index d1d7d81..e3443ff 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,7 +1,6 @@
 -r requirements.txt
 
 copr
-mock
 pytest
 pytest-cov
 vcrpy
diff --git a/tests/handlers/bob/test_rebuild_images_on_image_advisory_change.py b/tests/handlers/bob/test_rebuild_images_on_image_advisory_change.py
index 7f3b89a..eef240d 100644
--- a/tests/handlers/bob/test_rebuild_images_on_image_advisory_change.py
+++ b/tests/handlers/bob/test_rebuild_images_on_image_advisory_change.py
@@ -20,7 +20,7 @@
 #
 # Written by Jan Kaluza <jkaluza@redhat.com>
 
-from mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
 
 import freshmaker
 from freshmaker.errata import ErrataAdvisory
diff --git a/tests/handlers/internal/test_freshmaker_manage_request.py b/tests/handlers/internal/test_freshmaker_manage_request.py
index c117036..d8f8f85 100644
--- a/tests/handlers/internal/test_freshmaker_manage_request.py
+++ b/tests/handlers/internal/test_freshmaker_manage_request.py
@@ -22,7 +22,7 @@
 
 import unittest
 
-from mock import patch
+from unittest.mock import patch
 
 from freshmaker import events, models, db
 from freshmaker.handlers.internal import CancelEventOnFreshmakerManageRequest
diff --git a/tests/handlers/internal/test_generate_advisory_signed_event_on_rpm_sign.py b/tests/handlers/internal/test_generate_advisory_signed_event_on_rpm_sign.py
index c3a7a17..af8a823 100644
--- a/tests/handlers/internal/test_generate_advisory_signed_event_on_rpm_sign.py
+++ b/tests/handlers/internal/test_generate_advisory_signed_event_on_rpm_sign.py
@@ -21,7 +21,7 @@
 #
 # Written by Chenxiong Qi <cqi@redhat.com>
 
-from mock import patch, MagicMock, PropertyMock
+from unittest.mock import patch, MagicMock, PropertyMock
 
 from freshmaker.handlers.internal import GenerateAdvisorySignedEventOnRPMSign
 from freshmaker.errata import ErrataAdvisory
diff --git a/tests/handlers/internal/test_update_db_on_advisory_change.py b/tests/handlers/internal/test_update_db_on_advisory_change.py
index 7eedb40..ef18ac8 100644
--- a/tests/handlers/internal/test_update_db_on_advisory_change.py
+++ b/tests/handlers/internal/test_update_db_on_advisory_change.py
@@ -21,7 +21,7 @@
 #
 # Written by Chenxiong Qi <cqi@redhat.com>
 
-from mock import patch, Mock
+from unittest.mock import patch, Mock
 
 from freshmaker import conf, db
 from freshmaker.errata import ErrataAdvisory
diff --git a/tests/handlers/koji/test_rebuild_images_on_odcs_compose_done.py b/tests/handlers/koji/test_rebuild_images_on_odcs_compose_done.py
index 63b056d..69e38b0 100644
--- a/tests/handlers/koji/test_rebuild_images_on_odcs_compose_done.py
+++ b/tests/handlers/koji/test_rebuild_images_on_odcs_compose_done.py
@@ -21,7 +21,7 @@
 #
 # Written by Chenxiong Qi <cqi@redhat.com>
 
-from mock import patch, PropertyMock
+from unittest.mock import patch, PropertyMock
 
 from freshmaker import db
 from freshmaker.models import (
diff --git a/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py b/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py
index 1f8e3a5..4f97f12 100644
--- a/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py
+++ b/tests/handlers/koji/test_rebuild_images_on_parent_image_build.py
@@ -20,11 +20,12 @@
 # SOFTWARE.
 
 import json
-import mock
 import os
 import sys
 import unittest
 
+from unittest import mock
+
 sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))  # noqa
 from tests import get_fedmsg, helpers
 
diff --git a/tests/handlers/koji/test_rebuild_images_on_rpm_advisory_change.py b/tests/handlers/koji/test_rebuild_images_on_rpm_advisory_change.py
index eff172d..237e5de 100644
--- a/tests/handlers/koji/test_rebuild_images_on_rpm_advisory_change.py
+++ b/tests/handlers/koji/test_rebuild_images_on_rpm_advisory_change.py
@@ -20,7 +20,7 @@
 # SOFTWARE.
 
 import json
-from mock import patch, PropertyMock, Mock, call
+from unittest.mock import patch, PropertyMock, Mock, call
 
 import freshmaker
 
diff --git a/tests/helpers.py b/tests/helpers.py
index 7eb150d..5dcf6b1 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -26,7 +26,7 @@ import uuid
 import unittest
 import koji
 
-from mock import patch, MagicMock, PropertyMock
+from unittest.mock import patch, MagicMock, PropertyMock
 from functools import wraps
 
 import freshmaker.consumer
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 3cb2b1c..c1abefb 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -24,7 +24,7 @@
 
 import flask
 
-from mock import patch, Mock
+from unittest.mock import patch, Mock
 from werkzeug.exceptions import Unauthorized
 
 import freshmaker.auth
diff --git a/tests/test_consumer.py b/tests/test_consumer.py
index 7bb2f33..a6196ca 100644
--- a/tests/test_consumer.py
+++ b/tests/test_consumer.py
@@ -18,8 +18,8 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-import mock
 import unittest
+from unittest import mock
 
 import freshmaker
 
diff --git a/tests/test_errata.py b/tests/test_errata.py
index 1e1dbc4..7a5897d 100644
--- a/tests/test_errata.py
+++ b/tests/test_errata.py
@@ -20,7 +20,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
 from requests_kerberos.exceptions import MutualAuthenticationError
 from requests.exceptions import HTTPError
 
diff --git a/tests/test_handler.py b/tests/test_handler.py
index 3c600c2..6970d4f 100644
--- a/tests/test_handler.py
+++ b/tests/test_handler.py
@@ -22,7 +22,7 @@
 #
 # Written by Chenxiong Qi <cqi@redhat.com>
 
-from mock import patch
+from unittest.mock import patch
 import json
 
 import freshmaker
diff --git a/tests/test_image_verifier.py b/tests/test_image_verifier.py
index 6946308..9fa13cc 100644
--- a/tests/test_image_verifier.py
+++ b/tests/test_image_verifier.py
@@ -21,7 +21,7 @@
 #
 # Written by Jan Kaluza <jkaluza@redhat.com>
 
-from mock import MagicMock
+from unittest.mock import MagicMock
 
 from freshmaker.image_verifier import ImageVerifier
 from tests import helpers
diff --git a/tests/test_lightblue.py b/tests/test_lightblue.py
index 5839547..979a59a 100644
--- a/tests/test_lightblue.py
+++ b/tests/test_lightblue.py
@@ -25,7 +25,7 @@ import json
 import io
 import http.client
 
-from mock import call, patch, Mock
+from unittest.mock import call, patch, Mock
 
 import freshmaker
 
diff --git a/tests/test_messaging.py b/tests/test_messaging.py
index 5b8e8c5..2cfa894 100644
--- a/tests/test_messaging.py
+++ b/tests/test_messaging.py
@@ -23,7 +23,7 @@
 
 import unittest
 
-from mock import patch
+from unittest.mock import patch
 
 from freshmaker import conf
 from freshmaker import messaging
diff --git a/tests/test_models.py b/tests/test_models.py
index 0e1c09e..d8fbdce 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -21,7 +21,7 @@
 # Written by Jan Kaluza <jkaluza@redhat.com>
 
 import datetime
-from mock import patch
+from unittest.mock import patch
 
 from freshmaker import db, events
 from freshmaker.models import ArtifactBuild, ArtifactType
diff --git a/tests/test_monitor.py b/tests/test_monitor.py
index 7bf66df..01e7596 100644
--- a/tests/test_monitor.py
+++ b/tests/test_monitor.py
@@ -20,12 +20,13 @@
 # SOFTWARE.
 
 import os
-import mock
 import pytest
 import freshmaker
 import requests
 import importlib
 
+from unittest import mock
+
 from freshmaker import app, db, events, models, login_manager
 from tests import helpers
 
diff --git a/tests/test_odcsclient.py b/tests/test_odcsclient.py
index 61817a8..ec7d61c 100644
--- a/tests/test_odcsclient.py
+++ b/tests/test_odcsclient.py
@@ -22,7 +22,7 @@
 # Written by Chenxiong Qi <cqi@redhat.com>
 #            Jan kaluza <jkaluza@redhat.com>
 
-from mock import patch, Mock
+from unittest.mock import patch, Mock
 from odcs.client.odcs import AuthMech
 
 from freshmaker import conf, db
diff --git a/tests/test_producer.py b/tests/test_producer.py
index 1d5118c..6e38185 100644
--- a/tests/test_producer.py
+++ b/tests/test_producer.py
@@ -24,7 +24,7 @@
 
 import koji
 
-from mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
 import queue
 
 from freshmaker import db
diff --git a/tests/test_pulp.py b/tests/test_pulp.py
index cc62829..ad25cb1 100644
--- a/tests/test_pulp.py
+++ b/tests/test_pulp.py
@@ -23,7 +23,7 @@
 
 import json
 
-from mock import patch
+from unittest.mock import patch
 
 from freshmaker.pulp import Pulp
 from tests import helpers
diff --git a/tests/test_sfm2.py b/tests/test_sfm2.py
index d0e322c..9cc3a5e 100644
--- a/tests/test_sfm2.py
+++ b/tests/test_sfm2.py
@@ -20,7 +20,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-from mock import patch, MagicMock
+from unittest.mock import patch, MagicMock
 
 from freshmaker.sfm2 import SFM2API
 from tests import helpers
diff --git a/tests/test_views.py b/tests/test_views.py
index 9b59d8a..4e8e838 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -26,7 +26,7 @@ import datetime
 import contextlib
 import flask
 
-from mock import patch
+from unittest.mock import patch
 
 from freshmaker import app, db, events, models, login_manager
 from freshmaker.types import ArtifactType, ArtifactBuildState, EventState

