def test_snmp_scan_prefetch_description_object__success(backend): sys_desc = snmp_cache.single_oid_cache()[snmp_scan.OID_SYS_DESCR] sys_obj = snmp_cache.single_oid_cache()[snmp_scan.OID_SYS_OBJ] assert sys_desc assert sys_obj snmp_scan._prefetch_description_object(backend=backend) # Success is no-op assert snmp_cache.single_oid_cache()[snmp_scan.OID_SYS_DESCR] == sys_desc assert snmp_cache.single_oid_cache()[snmp_scan.OID_SYS_OBJ] == sys_obj
def test_snmp_scan_prefetch_description_object__success(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._prefetch_description_object(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
def test_snmp_scan_prefetch_description_object__oid_missing(oid, backend): snmp_cache.single_oid_cache()[oid] = None with pytest.raises(snmp_scan.MKSNMPError, match=r"Cannot fetch [\w ]+ OID %s" % oid): snmp_scan._prefetch_description_object(backend=backend)