about summary refs log tree commit diff
diff options
context:
space:
mode:
authorVika <vika@fireburn.ru>2023-02-27 00:32:47 +0300
committerVika <vika@fireburn.ru>2023-02-27 00:32:47 +0300
commit06e27ddee1d090086c4b2b01cbbfec928a9264bc (patch)
tree2dbf9a059b62048b53e485bc9835cf1e336ff214
parent3985d0f551236e5413e0807239f75d178f82ff3d (diff)
downloadkittybox-06e27ddee1d090086c4b2b01cbbfec928a9264bc.tar.zst
tempfile -> tempdir, remove mockito
-rw-r--r--kittybox-rs/Cargo.lock74
-rw-r--r--kittybox-rs/Cargo.toml3
-rw-r--r--kittybox-rs/src/database/mod.rs2
-rw-r--r--kittybox-rs/src/media/storage/file.rs4
4 files changed, 5 insertions, 78 deletions
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
@@ -432,17 +432,6 @@ dependencies = [
 ]
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -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",
@@ -1691,28 +1679,6 @@ dependencies = [
 ]
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2225,19 +2191,6 @@ dependencies = [
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 checksum = "6d71dacdc3c88c1fde3885a3be3fbab9f35724e6ce99467f7d9c5026132184ca"
@@ -2494,15 +2447,6 @@ 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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -2863,12 +2807,6 @@ dependencies = [
 ]
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -3036,16 +2974,6 @@ dependencies = [
 ]
 
 [[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"
 source = "registry+https://github.com/rust-lang/crates.io-index"
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");