diff --git a/Cargo.toml b/Cargo.toml index 089e0ab..b0a2ddc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,8 +11,8 @@ repository = "https://github.com/trivernis/hydrus-api-rs" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -serde = {version = "^1.0", features = ["derive"]} -reqwest = {version = "0.11.4", features = ["json"]} +serde = { version = "1.0.136", features = ["derive"] } +reqwest = { version = "0.11.9", features = ["json"] } tracing = "0.1.31" mime = "0.3.16" chrono = "0.4.19" @@ -25,8 +25,8 @@ dotenv = "0.15.0" tracing-subscriber = "0.3.9" [dev-dependencies.tokio] -version = "1.8.0" +version = "1.17.0" features = ["macros", "rt-multi-thread"] [features] -rustls = ["reqwest/rustls"] \ No newline at end of file +rustls = ["reqwest/rustls"] diff --git a/tests/client/test_searching_and_fetching_files.rs b/tests/client/test_searching_and_fetching_files.rs index 89dcd14..0a1eed0 100644 --- a/tests/client/test_searching_and_fetching_files.rs +++ b/tests/client/test_searching_and_fetching_files.rs @@ -8,7 +8,7 @@ async fn is_searches_files() { let client = common::get_client(); let options = FileSearchOptions::new() .sort_type(SORT_FILE_PIXEL_COUNT) - .tag_service_name("public tag repository") + .tag_service_name("my tags") .file_service_name("all known files"); client .search_files( diff --git a/tests/common.rs b/tests/common.rs index 5dda720..78cdac3 100644 --- a/tests/common.rs +++ b/tests/common.rs @@ -1,14 +1,16 @@ use hydrus_api::api_core::client::Client; use hydrus_api::Hydrus; use std::env; -use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::Arc; +use std::sync::{Arc, Mutex, MutexGuard}; pub fn setup() { - lazy_static::lazy_static! { static ref SETUP_DONE: Arc = Arc::new(AtomicBool::new(false)); } - if !SETUP_DONE.swap(true, Ordering::SeqCst) { + lazy_static::lazy_static! { static ref SETUP_DONE: Arc> = Arc::new(Mutex::new(false)); } + let mut setup_done: MutexGuard = SETUP_DONE.lock().unwrap(); + + if !*setup_done { dotenv::dotenv().expect("failed to initialize dotenv"); tracing_subscriber::fmt::init(); + *setup_done = true; } } diff --git a/tests/wrapper/test_files.rs b/tests/wrapper/test_files.rs index 5291bfe..1e40692 100644 --- a/tests/wrapper/test_files.rs +++ b/tests/wrapper/test_files.rs @@ -54,7 +54,7 @@ async fn it_has_tags() { async fn it_adds_tags() { let mut file = get_file().await; file.add_tags( - ServiceName::public_tag_repository(), + ServiceName::my_tags(), vec!["character:megumin".into(), "ark mage".into()], ) .await @@ -65,7 +65,7 @@ async fn it_adds_tags() { async fn it_modifies_tags() { let mut file = get_file().await; file.modify_tags( - ServiceName::public_tag_repository(), + ServiceName::my_tags(), TagAction::RescindPendFromRepository, vec!["ark mage".into()], )