def test_get_netstat_i(): result = Netstat_I(context_wrap(NETSTAT_I)).group_by_iface assert len(result) == 7 assert result["bond0"] == { "MTU": "1500", "Met": "0", "RX-OK": "845265", "RX-ERR": "0", "RX-DRP": "0", "RX-OVR": "0", "TX-OK": "1753", "TX-ERR": "0", "TX-DRP": "0", "TX-OVR": "0", "Flg": "BMmRU" } assert result["eth0"] == { "MTU": "1500", "Met": "0", "RX-OK": "422518", "RX-ERR": "0", "RX-DRP": "0", "RX-OVR": "0", "TX-OK": "1703", "TX-ERR": "0", "TX-DRP": "0", "TX-OVR": "0", "Flg": "BMsRU" }
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