Remove mox from nova/tests/unit/test_iptables_network.py

Replace stubs.Set() with mock.patch.object

Part of blueprint remove-mox-newton

Change-Id: Id2820d0908a302a05699de74d8e2a8f3bafb4c6d
This commit is contained in:
Nguyen Hung Phuong
2016-06-01 21:22:58 +07:00
parent ced89e7b26
commit bd37ab2d98

View File

@@ -15,6 +15,7 @@
# under the License.
"""Unit Tests for network code."""
import mock
import six
from nova.network import linux_net
@@ -107,11 +108,9 @@ class IptablesManagerTestCase(test.NoDBTestCase):
for table in six.itervalues(self.manager.ipv6):
table.dirty = False
def error_apply():
raise test.TestingException()
self.stubs.Set(self.manager, '_apply', error_apply)
self.manager.apply()
with mock.patch.object(self.manager, '_apply') as mock_apply:
self.manager.apply()
self.assertFalse(mock_apply.called)
def test_filter_rules_are_wrapped(self):
current_lines = self.sample_filter