#![allow(dead_code)]
use pubmed_client::{Client, ClientConfig, PmcClient, PubMedClient};
pub fn should_run_real_api_tests() -> bool {
std::env::var("PUBMED_REAL_API_TESTS").is_ok()
}
pub fn create_test_client() -> Client {
let mut config = ClientConfig::new()
.with_email("test@example.com")
.with_tool("pubmed-client-rs-integration-tests")
.with_rate_limit(2.0);
if let Ok(api_key) = std::env::var("NCBI_API_KEY") {
config = config.with_api_key(&api_key).with_rate_limit(8.0); }
Client::with_config(config)
}
pub fn create_test_pubmed_client() -> PubMedClient {
let mut config = ClientConfig::new()
.with_email("test@example.com")
.with_tool("pubmed-client-rs-pubmed-integration-tests")
.with_rate_limit(2.0);
if let Ok(api_key) = std::env::var("NCBI_API_KEY") {
config = config.with_api_key(&api_key).with_rate_limit(8.0);
}
PubMedClient::with_config(config)
}
pub fn create_test_pmc_client() -> PmcClient {
let mut config = ClientConfig::new()
.with_email("test@example.com")
.with_tool("pubmed-client-rs-pmc-integration-tests")
.with_rate_limit(2.0);
if let Ok(api_key) = std::env::var("NCBI_API_KEY") {
config = config.with_api_key(&api_key).with_rate_limit(8.0);
}
PmcClient::with_config(config)
}
pub const TEST_PMIDS: &[u32] = &[
31978945, 25760099, 33515491, 32887691, 28495875, ];
pub const TEST_PMIDS_STR: &[&str] = &[
"31978945", "25760099", "33515491", "32887691", "28495875", ];
pub const TEST_PMCIDS: &[&str] = &[
"PMC7138338", "PMC4395896", "PMC7894017", "PMC7567892", "PMC5431048", ];
pub const TEST_SEARCH_QUERIES: &[&str] = &[
"COVID-19[Title]",
"CRISPR[Title]",
"cancer treatment[Title]",
"machine learning[Title]",
"genomics[Title]",
];