def test_get_route(self): """ Test if it return information on open ports and states """ ret = ("\n\n" "IPAddress : 10.0.0.15\n" "InterfaceIndex : 3\n" "InterfaceAlias : Wi-Fi\n" "AddressFamily : IPv4\n" "Type : Unicast\n" "PrefixLength : 24\n" "PrefixOrigin : Dhcp\n" "SuffixOrigin : Dhcp\n" "AddressState : Preferred\n" "ValidLifetime : 6.17:52:39\n" "PreferredLifetime : 6.17:52:39\n" "SkipAsSource : False\n" "PolicyStore : ActiveStore\n" "\n\n" "Caption :\n" "Description :\n" "ElementName :\n" "InstanceID : :8:8:8:9:55=55;:8;8;:8;55;\n" "AdminDistance :\n" "DestinationAddress :\n" "IsStatic :\n" "RouteMetric : 0\n" "TypeOfRoute : 3\n" "AddressFamily : IPv4\n" "CompartmentId : 1\n" "DestinationPrefix : 0.0.0.0/0\n" "InterfaceAlias : Wi-Fi\n" "InterfaceIndex : 3\n" "NextHop : 10.0.0.1\n" "PreferredLifetime : 6.23:14:43\n" "Protocol : NetMgmt\n" "Publish : No\n" "Store : ActiveStore\n" "ValidLifetime : 6.23:14:43\n" "PSComputerName :\n" "ifIndex : 3") mock = MagicMock(return_value=ret) with patch.dict(win_network.__salt__, {"cmd.run": mock}): self.assertDictEqual( win_network.get_route("192.0.0.8"), { "destination": "192.0.0.8", "gateway": "10.0.0.1", "interface": "Wi-Fi", "source": "10.0.0.15", }, )
def test_get_route(self): ''' Test if it return information on open ports and states ''' ret = ('\n\n' 'IPAddress : 10.0.0.15\n' 'InterfaceIndex : 3\n' 'InterfaceAlias : Wi-Fi\n' 'AddressFamily : IPv4\n' 'Type : Unicast\n' 'PrefixLength : 24\n' 'PrefixOrigin : Dhcp\n' 'SuffixOrigin : Dhcp\n' 'AddressState : Preferred\n' 'ValidLifetime : 6.17:52:39\n' 'PreferredLifetime : 6.17:52:39\n' 'SkipAsSource : False\n' 'PolicyStore : ActiveStore\n' '\n\n' 'Caption :\n' 'Description :\n' 'ElementName :\n' 'InstanceID : :8:8:8:9:55=55;:8;8;:8;55;\n' 'AdminDistance :\n' 'DestinationAddress :\n' 'IsStatic :\n' 'RouteMetric : 0\n' 'TypeOfRoute : 3\n' 'AddressFamily : IPv4\n' 'CompartmentId : 1\n' 'DestinationPrefix : 0.0.0.0/0\n' 'InterfaceAlias : Wi-Fi\n' 'InterfaceIndex : 3\n' 'NextHop : 10.0.0.1\n' 'PreferredLifetime : 6.23:14:43\n' 'Protocol : NetMgmt\n' 'Publish : No\n' 'Store : ActiveStore\n' 'ValidLifetime : 6.23:14:43\n' 'PSComputerName :\n' 'ifIndex : 3') mock = MagicMock(return_value=ret) with patch.dict(win_network.__salt__, {'cmd.run': mock}): self.assertDictEqual( win_network.get_route('192.0.0.8'), { 'destination': '192.0.0.8', 'gateway': '10.0.0.1', 'interface': 'Wi-Fi', 'source': '10.0.0.15' })