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
[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"]
rustls = ["reqwest/rustls"]

@ -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(

@ -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<AtomicBool> = Arc::new(AtomicBool::new(false)); }
if !SETUP_DONE.swap(true, Ordering::SeqCst) {
lazy_static::lazy_static! { static ref SETUP_DONE: Arc<Mutex<bool>> = Arc::new(Mutex::new(false)); }
let mut setup_done: MutexGuard<bool> = SETUP_DONE.lock().unwrap();
if !*setup_done {
dotenv::dotenv().expect("failed to initialize dotenv");
tracing_subscriber::fmt::init();
*setup_done = true;
}
}

@ -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()],
)

Loading…
Cancel
Save