From 045b1ee3284de807d6e5e424b46f5167eb95e2f7 Mon Sep 17 00:00:00 2001 From: xiaozhuangqing Date: Wed, 21 Sep 2016 11:00:32 +0800 Subject: [PATCH] Replace 'MagicMock' with 'Mock' Mock allows you to assign functions (or other Mock instances) to magic methods and they will be called appropriately. The MagicMock class is just a Mock variant that has all of the magic methods pre-created for you (well, all the useful ones anyway).[1] [1] https://docs.python.org/3/library/unittest.mock.html related-bug: 1475722 Change-Id: I92c420800af5a612929e9a187299e5d3b510f3c5 --- senlin/tests/unit/api/openstack/v1/test_clusters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/senlin/tests/unit/api/openstack/v1/test_clusters.py b/senlin/tests/unit/api/openstack/v1/test_clusters.py index 18626bebf..358d9fb39 100644 --- a/senlin/tests/unit/api/openstack/v1/test_clusters.py +++ b/senlin/tests/unit/api/openstack/v1/test_clusters.py @@ -575,7 +575,7 @@ class ClusterControllerTest(shared.ControllerTest, base.SenlinTestCase): req = self._post('/clusters', jsonutils.dumps(body)) error = senlin_exc.HTTPExceptionDisguise(webob.exc.HTTPBadRequest()) - self.controller.create = mock.MagicMock(side_effect=error) + self.controller.create = mock.Mock(side_effect=error) resp = shared.request_with_middleware(fault.FaultWrapper, self.controller.create, req,