Patch salt.utils.which for test_route test

This commit is contained in:
Ch3LL 2017-06-21 10:55:01 -04:00
parent 51f7e107dc
commit d2076a6c93

View File

@ -335,12 +335,13 @@ class NetworkTestCase(TestCase):
self.assertRaises(CommandExecutionError, network.routes, 'inet')
with patch.dict(network.__grains__, {'kernel': 'Linux'}):
with patch.object(network, '_netstat_route_linux',
side_effect=['A', [{'addr_family': 'inet'}]]):
self.assertEqual(network.routes(None), 'A')
with patch.object(salt.utils, 'which', return_value=True):
with patch.object(network, '_netstat_route_linux',
side_effect=['A', [{'addr_family': 'inet'}]]):
self.assertEqual(network.routes(None), 'A')
self.assertListEqual(network.routes('inet'),
[{'addr_family': 'inet'}])
self.assertListEqual(network.routes('inet'),
[{'addr_family': 'inet'}])
def test_default_route(self):
'''