From 6641c9f8c0cb69e8495cb4360f50c5e048c50be1 Mon Sep 17 00:00:00 2001 From: Dan Sneddon Date: Mon, 23 Jul 2018 19:22:44 -0700 Subject: [PATCH] Stub out check for OVS installed to avoid failing tests The tests for the method that checks to see if OVS is installed only pass if OVS is not installed. This change stubs out the function so the tests pass on systems with OVS. Closes-bug: #1783240 Change-Id: I70bee7a7556aada186ccec89dbe800c8eb870aa5 --- os_net_config/tests/test_objects.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/os_net_config/tests/test_objects.py b/os_net_config/tests/test_objects.py index 91a60233..b857027e 100644 --- a/os_net_config/tests/test_objects.py +++ b/os_net_config/tests/test_objects.py @@ -1734,6 +1734,9 @@ class TestVppBond(base.TestCase): class TestOvsRequiredObjects(base.TestCase): + def stub_is_ovs_installed(self): + return False + def test_ovs_bond(self): data = """{ "type": "ovs_bond", @@ -1752,6 +1755,8 @@ class TestOvsRequiredObjects(base.TestCase): } """ + self.stub_out('os_net_config.utils.is_ovs_installed', + self.stub_is_ovs_installed) err = self.assertRaises(objects.InvalidConfigException, objects.OvsBond.from_json, json.loads(data)) @@ -1770,6 +1775,8 @@ class TestOvsRequiredObjects(base.TestCase): } """ + self.stub_out('os_net_config.utils.is_ovs_installed', + self.stub_is_ovs_installed) err = self.assertRaises(objects.InvalidConfigException, objects.OvsBridge.from_json, json.loads(data)) @@ -1785,6 +1792,8 @@ class TestOvsRequiredObjects(base.TestCase): } """ + self.stub_out('os_net_config.utils.is_ovs_installed', + self.stub_is_ovs_installed) err = self.assertRaises(objects.InvalidConfigException, objects.OvsDpdkPort.from_json, json.loads(data))