Test fix: only non-localhost IP should persist

This commit is contained in:
Bo Maryniuk 2016-06-15 14:07:29 +02:00
parent 263c039db9
commit 97ef3bdb76

View File

@ -305,11 +305,15 @@ class NetworkTestCase(TestCase):
@patch('socket.getaddrinfo', MagicMock(return_value=[(2, 3, 0, 'localhost', ('127.0.1.1', 0))])) @patch('socket.getaddrinfo', MagicMock(return_value=[(2, 3, 0, 'localhost', ('127.0.1.1', 0))]))
@patch('salt.utils.fopen', MagicMock(return_valute=False)) @patch('salt.utils.fopen', MagicMock(return_valute=False))
@patch('os.path.exists', MagicMock(return_valute=False)) @patch('os.path.exists', MagicMock(return_valute=False))
@patch('salt.utils.network.ip_addrs', MagicMock(return_value=['127.0.0.1', '::1', 'fe00::0', 'fe02::1'])) @patch('salt.utils.network.ip_addrs', MagicMock(return_value=['127.0.0.1', '::1', 'fe00::0', 'fe02::1', '1.2.3.4']))
def test_generate_minion_id_platform_localhost_filtered_all(self): def test_generate_minion_id_platform_localhost_filtered_all(self):
''' '''
Test if any of the localhost is filtered from anywhere. Test if any of the localhost is filtered from everywhere.
In this case Minion ID cannot be generated, but so is no networking.
:return:
'''
self.assertEqual(network.generate_minion_id(), '1.2.3.4')
:return: :return:
''' '''