python-ifaddr/tests/test_ifaddr.py
Rafael Guterres Jeffman 77a1ebe17e Add gating.yml and gating tests.
Signed-off-by: Rafael Guterres Jeffman <rjeffman@redhat.com>
2024-09-13 11:29:59 -03:00

15 lines
328 B
Python

import pytest
import ifaddr
def test_get_adapters():
"""Test 'get_adapters' against 'lo' interface."""
lo_ips = [
n.ip if not isinstance(n.ip, tuple) else n.ip[0]
for a in ifaddr.get_adapters() if a.name == "lo"
for n in a.ips
]
assert "127.0.0.1" in lo_ips
assert "::1" in lo_ips