]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Improve readability of MagicMock use in RYU test
authorKevin Benton <blak111@gmail.com>
Fri, 30 May 2014 04:15:22 +0000 (21:15 -0700)
committerKevin Benton <blak111@gmail.com>
Fri, 30 May 2014 04:15:22 +0000 (21:15 -0700)
Replaces an unnecessarily complex setup of a magicmock
in an RYU test module.

Change-Id: If2e99ff76114d896a6480a884a531f901198caa5

neutron/tests/unit/ryu/test_ryu_security_group.py

index 16f92f088fe72355e3b6e9f33ff60ee75e30f641..aadbe8266b6636fc8bc618bc452ad950912aab9c 100644 (file)
@@ -38,10 +38,7 @@ class RyuSecurityGroupsTestCase(test_sg.SecurityGroupDBTestCase):
     def setUp(self, plugin=None):
         test_sg_rpc.set_firewall_driver(test_sg_rpc.FIREWALL_HYBRID_DRIVER)
         self.fake_ryu = fake_ryu.patch_fake_ryu_client().start()
-        notifier_p = mock.patch(NOTIFIER)
-        notifier_cls = notifier_p.start()
-        self.notifier = mock.Mock()
-        notifier_cls.return_value = self.notifier
+        self.notifier = mock.patch(NOTIFIER).start().return_value
         self._attribute_map_bk_ = {}
         for item in attributes.RESOURCE_ATTRIBUTE_MAP:
             self._attribute_map_bk_[item] = (attributes.