diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:15:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-09-04 09:15:24 +0000 |
commit | fd6bd8e3ee83881f2f40686b21502926ddf977af (patch) | |
tree | 6093d44e4716db2c1f768c23c78359e34bb8e819 /test/test-iputil.py | |
parent | Adding upstream version 2.3~rc3. (diff) | |
download | nvme-stas-fd6bd8e3ee83881f2f40686b21502926ddf977af.tar.xz nvme-stas-fd6bd8e3ee83881f2f40686b21502926ddf977af.zip |
Adding upstream version 2.3~rc4.upstream/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__": |