MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / test_provider

Function test_provider

deployments/desktop/shared/agents.py:1232–1266  ·  view source on GitHub ↗

Run an opt-in provider smoke test for the settings page.

(kind: str)

Source from the content-addressed store, hash-verified

1230 return value
1231 return str(value or "").strip().lower() in {"1", "true", "yes", "on"}
1232
1233
1234def _daily_cache_matches_settings(
1235 cached_push: Dict[str, Any],
1236 *,
1237 days: int,
1238 limit_per_source: int,
1239 target_date: str,
1240 sources: Dict[str, Any],
1241) -> bool:
1242 metadata = dict(cached_push.get("metadata") or {})
1243 try:
1244 cached_daily_limit = int(_to_float(metadata.get("daily_limit"), -1))
1245 except (TypeError, ValueError):
1246 cached_daily_limit = -1
1247 if cached_daily_limit != int(limit_per_source):
1248 return False
1249 if int(_to_float(metadata.get("limit_per_source"), -1)) != int(limit_per_source):
1250 return False
1251 if int(_to_float(metadata.get("relevance_threshold"), -1)) != _configured_relevance_threshold():
1252 return False
1253 if int(_to_float(metadata.get("fetch_days"), -1)) != max(1, int(days or 1)):
1254 return False
1255 requested_target_date = str(target_date or "").strip()
1256 cached_target_date = str(metadata.get("target_date") or "").strip()
1257 if requested_target_date and cached_target_date != requested_target_date:
1258 return False
1259 if cached_target_date and cached_target_date != requested_target_date:
1260 return False
1261
1262 for key in ("arxiv_categories", "conferences", "journals", "custom_rss_urls"):
1263 if _normalized_cache_list(metadata.get(key)) != _normalized_cache_list(sources.get(key)):
1264 return False
1265 for key in ("enable_semantic_scholar", "enable_custom_rss"):
1266 if _cache_bool(metadata.get(key)) != bool(sources.get(key)):
1267 return False
1268 return True
1269

Callers

nothing calls this directly

Calls 4

build_llm_providerFunction · 0.90
build_embedding_providerFunction · 0.90
generateMethod · 0.45
embedMethod · 0.45

Tested by

no test coverage detected