def test_netstat(self):
        with patch.dict(network.__grains__, {'kernel': 'Linux'}):
            with patch.object(network, '_netstat_linux', return_value='A'):
                self.assertEqual(network.netstat(), 'A')

        with patch.dict(network.__grains__, {'kernel': 'OpenBSD'}):
            with patch.object(network, '_netstat_bsd', return_value='A'):
                self.assertEqual(network.netstat(), 'A')

        with patch.dict(network.__grains__, {'kernel': 'A'}):
            self.assertRaises(CommandExecutionError, network.netstat)
Test for return information on open ports and states
dataset/ETHPy150Open saltstack/salt/tests/unit/modules/network_test.py/NetworkTestCase.test_netstat