diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:15:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:15:27 +0000 |
commit | 425e2c731a79f34454b3b7b35b29040304850197 (patch) | |
tree | 61210e82c8a610c113334f9956ef06f4cb0f3396 /test/test-iputil.py | |
parent | Releasing debian version 2.3~rc3-1. (diff) | |
download | nvme-stas-425e2c731a79f34454b3b7b35b29040304850197.tar.xz nvme-stas-425e2c731a79f34454b3b7b35b29040304850197.zip |
Merging upstream version 2.3~rc4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test-iputil.py')
-rwxr-xr-x | test/test-iputil.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/test-iputil.py b/test/test-iputil.py index 3af734f..b0a5448 100755 --- a/test/test-iputil.py +++ b/test/test-iputil.py @@ -31,14 +31,17 @@ class Test(unittest.TestCase): def test_get_interface(self): '''Check that get_interface() returns the right info''' + ifaces = iputil.net_if_addrs() for iface in self.ifaces: for addr_entry in iface['addr_info']: addr = ipaddress.ip_address(addr_entry['local']) # Link local addresses may appear on more than one interface and therefore cannot be used. if not addr.is_link_local: - self.assertEqual(iface['ifname'], iputil.get_interface(str(addr))) + self.assertEqual(iface['ifname'], iputil.get_interface(ifaces, addr)) - self.assertEqual('', iputil.get_interface('255.255.255.255')) + self.assertEqual('', iputil.get_interface(ifaces, iputil.get_ipaddress_obj('255.255.255.255'))) + self.assertEqual('', iputil.get_interface(ifaces, '')) + self.assertEqual('', iputil.get_interface(ifaces, None)) def test_mac2iface(self): for iface in self.ifaces: @@ -69,9 +72,7 @@ class Test(unittest.TestCase): self.assertNotIn(bad_trtype, l2) def test__data_matches_ip(self): - self.assertFalse(iputil._data_matches_ip(None, None, None)) - self.assertFalse(iputil._data_matches_ip(socket.AF_INET, None, None)) - self.assertFalse(iputil._data_matches_ip(socket.AF_INET6, None, None)) + self.assertFalse(iputil.ip_equal(None, None)) if __name__ == "__main__": |