From 06e27ddee1d090086c4b2b01cbbfec928a9264bc Mon Sep 17 00:00:00 2001 From: Vika Date: Mon, 27 Feb 2023 00:32:47 +0300 Subject: tempfile -> tempdir, remove mockito --- kittybox-rs/Cargo.lock | 74 +---------------------------------- kittybox-rs/Cargo.toml | 3 +- kittybox-rs/src/database/mod.rs | 2 +- kittybox-rs/src/media/storage/file.rs | 4 +- 4 files changed, 5 insertions(+), 78 deletions(-) (limited to 'kittybox-rs') diff --git a/kittybox-rs/Cargo.lock b/kittybox-rs/Cargo.lock index 966e3ab..478b94d 100644 --- a/kittybox-rs/Cargo.lock +++ b/kittybox-rs/Cargo.lock @@ -431,17 +431,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "colored" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3616f750b84d8f0de8a58bda93e08e2a81ad3f523089b05f1dffecab48c6cbd" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - [[package]] name = "combine" version = "4.6.6" @@ -1383,7 +1372,6 @@ dependencies = [ "listenfd", "markdown", "microformats", - "mockito", "newbase60", "prometheus", "rand 0.8.5", @@ -1395,7 +1383,7 @@ dependencies = [ "serde_urlencoded", "serde_variant", "sha2", - "tempdir", + "tempfile", "thiserror", "tokio", "tokio-stream", @@ -1690,28 +1678,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "mockito" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09908a0c0e8c956c1360268b54c0f7eeefc7ef98020cfb81077fa71761a18d29" -dependencies = [ - "assert-json-diff", - "async-trait", - "colored", - "deadpool", - "futures", - "hyper", - "lazy_static", - "log", - "rand 0.8.5", - "regex", - "serde_json", - "serde_urlencoded", - "similar", - "tokio", -] - [[package]] name = "multer" version = "2.0.4" @@ -2223,19 +2189,6 @@ dependencies = [ "proc-macro2 1.0.51", ] -[[package]] -name = "rand" -version = "0.4.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293" -dependencies = [ - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "rdrand", - "winapi", -] - [[package]] name = "rand" version = "0.6.5" @@ -2493,15 +2446,6 @@ version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3bf6b372449361333ac1f498b7edae4dd5e70dccd7c0c2a7c7bce8f05ede648" -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] - [[package]] name = "reqwest" version = "0.11.14" @@ -2862,12 +2806,6 @@ dependencies = [ "libc", ] -[[package]] -name = "similar" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "420acb44afdae038210c99e69aae24109f32f15500aa708e81d46c9f29d55fcf" - [[package]] name = "siphasher" version = "0.2.3" @@ -3035,16 +2973,6 @@ dependencies = [ "unicode-xid 0.2.4", ] -[[package]] -name = "tempdir" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -dependencies = [ - "rand 0.4.6", - "remove_dir_all", -] - [[package]] name = "tempfile" version = "3.4.0" diff --git a/kittybox-rs/Cargo.toml b/kittybox-rs/Cargo.toml index 566cb57..16b617e 100644 --- a/kittybox-rs/Cargo.toml +++ b/kittybox-rs/Cargo.toml @@ -53,8 +53,7 @@ features = ["axum"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dev-dependencies] -mockito = "^0.32.3" # HTTP mocking for Rust. -tempdir = "^0.3.7" # A library for managing a temporary directory and deleting all contents when it's dropped +tempfile = "^3.4.0" # Temporary file managment wiremock = "^0.5.14" faker_rand = "^0.1.1" # Seedable, rand-compatible generators of fake data rand = "^0.8.5" # Utilities for random number generation diff --git a/kittybox-rs/src/database/mod.rs b/kittybox-rs/src/database/mod.rs index 9072d9d..24cff38 100644 --- a/kittybox-rs/src/database/mod.rs +++ b/kittybox-rs/src/database/mod.rs @@ -546,7 +546,7 @@ mod tests { #[tokio::test] #[tracing_test::traced_test] async fn $func_name() { - let tempdir = tempdir::TempDir::new("file").expect("Failed to create tempdir"); + let tempdir = tempfile::tempdir().expect("Failed to create tempdir"); let backend = super::super::FileStorage::new( tempdir.path().to_path_buf() ) diff --git a/kittybox-rs/src/media/storage/file.rs b/kittybox-rs/src/media/storage/file.rs index 6d7068b..cb9cadb 100644 --- a/kittybox-rs/src/media/storage/file.rs +++ b/kittybox-rs/src/media/storage/file.rs @@ -259,7 +259,7 @@ mod tests { #[tokio::test] #[tracing_test::traced_test] async fn test_ranges() { - let tempdir = tempdir::TempDir::new("file").expect("Failed to create tempdir"); + let tempdir = tempfile::tempdir().expect("Failed to create tempdir"); let store = FileStore::new(tempdir.path()); let file: &[u8] = include_bytes!("./file.rs"); @@ -370,7 +370,7 @@ mod tests { #[tokio::test] #[tracing_test::traced_test] async fn test_streaming_read_write() { - let tempdir = tempdir::TempDir::new("file").expect("Failed to create tempdir"); + let tempdir = tempfile::tempdir().expect("Failed to create tempdir"); let store = FileStore::new(tempdir.path()); let file: &[u8] = include_bytes!("./file.rs"); -- cgit 1.4.1