Skip to content

Commit 7cfc112

Browse files
authored
update mockito to 0.32.0 (#1212)
1 parent c8697a6 commit 7cfc112

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

sdk/iot_deviceupdate/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ azure_identity = { path = "../identity", version="0.9", default_features = false
2828

2929
[dev-dependencies]
3030
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
31-
mockito = "0.31"
31+
mockito = "0.32.2"
3232
async-trait = "0.1"
3333

3434
[features]

sdk/iot_deviceupdate/src/device_update.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -509,22 +509,25 @@ impl DeviceUpdateClient {
509509
#[cfg(test)]
510510
mod tests {
511511
use azure_core::date;
512-
use mockito::{mock, Matcher};
512+
use mockito::{Matcher, Server};
513513
use serde_json::json;
514514

515515
use crate::{client::API_VERSION, tests::mock_client};
516516

517517
#[tokio::test]
518518
async fn can_import_update() -> azure_core::Result<()> {
519-
let _m = mock("POST", "/deviceupdate/test-instance/updates")
519+
let mut server = Server::new_async().await;
520+
let _m = server
521+
.mock("POST", "/deviceupdate/test-instance/updates")
520522
.match_query(Matcher::UrlEncoded(
521523
"api-version".into(),
522524
API_VERSION.into(),
523525
))
524526
.with_header("operation-location", "/op_location")
525527
.with_status(202)
526-
.create();
527-
let _op = mock("GET", "/op_location")
528+
.create_async()
529+
.await;
530+
let _op = server.mock("GET", "/op_location")
528531
.with_header("content-type", "application/json")
529532
.with_body(
530533
json!({
@@ -544,9 +547,9 @@ mod tests {
544547
.to_string(),
545548
)
546549
.with_status(200)
547-
.create();
550+
.create_async().await;
548551

549-
let client = mock_client();
552+
let client = mock_client(server.url());
550553

551554
let update = client
552555
.import_update(

sdk/iot_deviceupdate/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ mod tests {
1414
use std::sync::Arc;
1515
use time::OffsetDateTime;
1616

17-
pub(crate) fn mock_client() -> crate::client::DeviceUpdateClient {
17+
pub(crate) fn mock_client(server_url: String) -> crate::client::DeviceUpdateClient {
1818
crate::client::DeviceUpdateClient {
19-
device_update_url: url::Url::parse(&mockito::server_url()).unwrap(),
19+
device_update_url: url::Url::parse(&server_url).unwrap(),
2020
endpoint: "".to_string(),
2121
token_credential: AutoRefreshingTokenCredential::new(Arc::new(MockCredential)),
2222
}

sdk/security_keyvault/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ azure_core = { path = "../core", version = "0.8", default-features = false }
2626

2727
[dev-dependencies]
2828
azure_identity = { path = "../identity", default-features = false }
29-
mockito = "0.31"
3029
async-trait = "0.1"
3130
tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] }
3231

0 commit comments

Comments
 (0)