Esempio n. 1
0
    def test_traceroute(self):
        '''
        Test for Performs a traceroute to a 3rd party host
        '''
        with patch.object(salt.utils.path, 'which', side_effect=[False, True]):
            self.assertListEqual(network.traceroute('host'), [])

            with patch.object(salt.utils.network, 'sanitize_host',
                              return_value='A'):
                with patch.dict(network.__salt__, {'cmd.run':
                                                   MagicMock(return_value="")}):
                    self.assertListEqual(network.traceroute('host'), [])
Esempio n. 2
0
    def test_traceroute(self):
        '''
        Test for Performs a traceroute to a 3rd party host
        '''
        with patch('salt.utils.path.which', MagicMock(return_value='traceroute')):
            with patch.dict(network.__salt__, {'cmd.run': MagicMock(return_value='')}):
                self.assertListEqual(network.traceroute('gentoo.org'), [])

            with patch.object(salt.utils.network, 'sanitize_host',
                              return_value='gentoo.org'):
                with patch.dict(network.__salt__, {'cmd.run':
                                                   MagicMock(return_value='')}):
                    self.assertListEqual(network.traceroute('gentoo.org'), [])