From d761621f684f889e79e70fc74b37de91bdcc7356 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Em=C4=ABls?= Date: Fri, 13 Dec 2024 11:42:22 +0100 Subject: [PATCH] Add mockito --- Cargo.lock | 53 +++++++++++++++++++++++++++++++++++++++++- mullvad-api/Cargo.toml | 6 +++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 90e8b3e0ba36..0d485f055eec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,6 +172,16 @@ version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +[[package]] +name = "assert-json-diff" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47e4f2b81832e72834d7518d8487a0396a28cc408186a2e8854c0f98011faf12" +dependencies = [ + "serde", + "serde_json", +] + [[package]] name = "async-stream" version = "0.3.5" @@ -592,6 +602,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "colored" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" +dependencies = [ + "lazy_static", + "windows-sys 0.59.0", +] + [[package]] name = "combine" version = "4.6.7" @@ -1067,7 +1087,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9f0c14694cbd524c8720dd69b0e3179344f04ebb5f90f2e4a440c6ea3b2f1ee" dependencies = [ - "colored", + "colored 1.9.4", "log", ] @@ -2321,6 +2341,30 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "mockito" +version = "1.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "652cd6d169a36eaf9d1e6bce1a221130439a966d7f27858af66a33a66e9c4ee2" +dependencies = [ + "assert-json-diff", + "bytes", + "colored 2.2.0", + "futures-util", + "http 1.1.0", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "log", + "rand 0.8.5", + "regex", + "serde_json", + "serde_urlencoded", + "similar", + "tokio", +] + [[package]] name = "mullvad-api" version = "0.0.0" @@ -2336,6 +2380,7 @@ dependencies = [ "ipnetwork", "libc", "log", + "mockito", "mullvad-encrypted-dns-proxy", "mullvad-fs", "mullvad-types", @@ -4114,6 +4159,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "similar" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" + [[package]] name = "simple-signal" version = "1.1.1" diff --git a/mullvad-api/Cargo.toml b/mullvad-api/Cargo.toml index a822593600e0..fc9d7d899b37 100644 --- a/mullvad-api/Cargo.toml +++ b/mullvad-api/Cargo.toml @@ -45,6 +45,7 @@ shadowsocks = { workspace = true, features = [ "stream-cipher" ] } [dev-dependencies] talpid-time = { path = "../talpid-time", features = ["test"] } tokio = { workspace = true, features = ["test-util", "time"] } +mockito = "1.6.1" [build-dependencies] cbindgen = { version = "0.24.3", default-features = false } @@ -55,3 +56,8 @@ uuid = { version = "1.4.1", features = ["v4"] } [lib] crate-type = [ "rlib", "staticlib" ] bench = false + +[[test]] +name = "ffi" +# required-features = [ "api-override" ] +features = [ "api-override" ]