Fix automated tests

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/9/head
trivernis 3 years ago
parent 8bb7149e11
commit be51ac4054
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -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 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies] [dependencies]
serde = {version = "^1.0", features = ["derive"]} serde = { version = "1.0.136", features = ["derive"] }
reqwest = {version = "0.11.4", features = ["json"]} reqwest = { version = "0.11.9", features = ["json"] }
tracing = "0.1.31" tracing = "0.1.31"
mime = "0.3.16" mime = "0.3.16"
chrono = "0.4.19" chrono = "0.4.19"
@ -25,8 +25,8 @@ dotenv = "0.15.0"
tracing-subscriber = "0.3.9" tracing-subscriber = "0.3.9"
[dev-dependencies.tokio] [dev-dependencies.tokio]
version = "1.8.0" version = "1.17.0"
features = ["macros", "rt-multi-thread"] features = ["macros", "rt-multi-thread"]
[features] [features]
rustls = ["reqwest/rustls"] rustls = ["reqwest/rustls"]

@ -8,7 +8,7 @@ async fn is_searches_files() {
let client = common::get_client(); let client = common::get_client();
let options = FileSearchOptions::new() let options = FileSearchOptions::new()
.sort_type(SORT_FILE_PIXEL_COUNT) .sort_type(SORT_FILE_PIXEL_COUNT)
.tag_service_name("public tag repository") .tag_service_name("my tags")
.file_service_name("all known files"); .file_service_name("all known files");
client client
.search_files( .search_files(

@ -1,14 +1,16 @@
use hydrus_api::api_core::client::Client; use hydrus_api::api_core::client::Client;
use hydrus_api::Hydrus; use hydrus_api::Hydrus;
use std::env; use std::env;
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::{Arc, Mutex, MutexGuard};
use std::sync::Arc;
pub fn setup() { pub fn setup() {
lazy_static::lazy_static! { static ref SETUP_DONE: Arc<AtomicBool> = Arc::new(AtomicBool::new(false)); } lazy_static::lazy_static! { static ref SETUP_DONE: Arc<Mutex<bool>> = Arc::new(Mutex::new(false)); }
if !SETUP_DONE.swap(true, Ordering::SeqCst) { let mut setup_done: MutexGuard<bool> = SETUP_DONE.lock().unwrap();
if !*setup_done {
dotenv::dotenv().expect("failed to initialize dotenv"); dotenv::dotenv().expect("failed to initialize dotenv");
tracing_subscriber::fmt::init(); tracing_subscriber::fmt::init();
*setup_done = true;
} }
} }

@ -54,7 +54,7 @@ async fn it_has_tags() {
async fn it_adds_tags() { async fn it_adds_tags() {
let mut file = get_file().await; let mut file = get_file().await;
file.add_tags( file.add_tags(
ServiceName::public_tag_repository(), ServiceName::my_tags(),
vec!["character:megumin".into(), "ark mage".into()], vec!["character:megumin".into(), "ark mage".into()],
) )
.await .await
@ -65,7 +65,7 @@ async fn it_adds_tags() {
async fn it_modifies_tags() { async fn it_modifies_tags() {
let mut file = get_file().await; let mut file = get_file().await;
file.modify_tags( file.modify_tags(
ServiceName::public_tag_repository(), ServiceName::my_tags(),
TagAction::RescindPendFromRepository, TagAction::RescindPendFromRepository,
vec!["ark mage".into()], vec!["ark mage".into()],
) )

Loading…
Cancel
Save