def test_snmp_scan_cache_description__success_binary(backend): snmp_scan._snmp_scan_cache_description( binary_host=True, do_snmp_scan=False, backend=backend, ) assert snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_DESCR) == "" assert snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_OBJ) == ""
def test_snmp_scan_cache_description__oid_missing(oid, backend): snmp_cache.set_single_oid_cache(oid, None) with pytest.raises(snmp_scan.MKSNMPError, match=r"Cannot fetch [\w ]+ OID %s" % oid): snmp_scan._snmp_scan_cache_description( False, do_snmp_scan=False, backend=backend, )
def test_snmp_scan_cache_description__success_non_binary(backend): sys_desc = snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_DESCR) sys_obj = snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_OBJ) assert sys_desc assert sys_obj snmp_scan._snmp_scan_cache_description( binary_host=False, do_snmp_scan=False, backend=backend, ) # Success is no-op assert snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_DESCR) == sys_desc assert snmp_cache.get_oid_from_single_oid_cache(snmp_scan.OID_SYS_OBJ) == sys_obj