def test_netstat_doc_examples(): env = { 'stats': NetstatS(context_wrap(NETSTAT_S)), 'multicast': NetstatAGN(context_wrap(TEST_NETSTAT_AGN)), 'ns': Netstat(context_wrap(NETSTAT_DOCS)), 'traf': Netstat_I(context_wrap(NETSTAT_I)), 'ss': SsTULPN(context_wrap(SS_TULPN_DOCS)), } failed, total = doctest.testmod(netstat, globs=env) assert failed == 0
def test_get_netstat_agn(): result = NetstatAGN(context_wrap(TEST_NETSTAT_AGN)).group_by_iface() assert len(result) == 2 assert len(result["lo"]) == 2 assert len(result["eth0"]) == 3 assert result["lo"] == [ {"refcnt": "1", "group": "224.0.0.1"}, {"refcnt": "3", "group": "ff02::1"}] assert result["eth0"] == [ {"refcnt": "1", "group": "224.0.0.1"}, {"refcnt": "4", "group": "ff02::1"}, {"refcnt": "1", "group": "ff01::1"}]