def test_is_physical_true(self, os_mock): iface = 'eth0' os_mock.path.realpath.return_value = \ '/sys/devices/pci0000:00/0000:00:03.0/net/eth0' self.assertTrue(network.is_physical(iface)) os_mock.path.realpath.assert_called_once_with( '/sys/class/net/{0}'.format(iface))
def test_is_physical_false(self, os_mock): iface = 'lo' os_mock.path.realpath.return_value = '/sys/devices/virtual/net/lo' self.assertFalse(network.is_physical(iface)) os_mock.path.realpath.assert_called_once_with( '/sys/class/net/{0}'.format(iface))