Skip to content

Commit 2db6554

Browse files
authored
update to httpmock 0.8 (#1303)
1 parent 2011483 commit 2db6554

File tree

9 files changed

+517
-2789
lines changed

9 files changed

+517
-2789
lines changed

Cargo.lock

Lines changed: 123 additions & 530 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ env_logger = "0.11.8"
3030
expectorate = { version = "1.2.0", features = ["predicates"] }
3131
flume = "0.12.0"
3232
futures = "0.3.31"
33-
httpmock = "0.7.0"
33+
httpmock = "0.8.2"
3434
humantime = "2.3.0"
3535
indicatif = "0.18.3"
3636
libc = "0.2.178"

cli/tests/test_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn test_simple_api_call() {
5151
.success()
5252
.stdout(predicate::str::diff("{\n \"a\": \"b\"\n}\n"));
5353

54-
mock.assert_hits(2);
54+
mock.assert_calls(2);
5555
}
5656

5757
#[derive(Serialize)]

cli/tests/test_auth.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,10 @@ impl<'a> MockOAuth<'a> {
8282
self.me.assert();
8383
}
8484

85-
fn assert_hits(&self, hits: usize) {
86-
self.device_auth.assert_hits(hits);
87-
self.device_token.assert_hits(hits);
88-
self.me.assert_hits(hits);
85+
fn assert_calls(&self, hits: usize) {
86+
self.device_auth.assert_calls(hits);
87+
self.device_token.assert_calls(hits);
88+
self.me.assert_calls(hits);
8989
}
9090
}
9191

@@ -394,7 +394,7 @@ fn test_auth_login_double() {
394394
&scrub_server(stdout.to_string(), server.url("")),
395395
);
396396

397-
mock.assert_hits(2);
397+
mock.assert_calls(2);
398398

399399
assert_contents(
400400
"tests/data/test_auth_double_credentials.toml",
@@ -516,7 +516,7 @@ fn test_cmd_auth_status() {
516516
.success()
517517
.stdout(str::is_empty());
518518

519-
ok.assert_hits(2);
519+
ok.assert_calls(2);
520520
bad.assert();
521521
}
522522

@@ -594,7 +594,7 @@ fn test_cmd_auth_status_env() {
594594
.failure()
595595
.stderr(format!("{}\n", oxide::OxideAuthError::HostProfileConflict));
596596

597-
oxide_mock.assert_hits(2);
597+
oxide_mock.assert_calls(2);
598598

599599
let oxide_mock = server.current_user_view(|when, then| {
600600
when.into_inner()

cli/tests/test_disk_import.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn test_disk_import() {
157157

158158
disk_create_mock.assert();
159159
start_bulk_write_mock.assert();
160-
disk_bulk_write_mock.assert_hits(2);
160+
disk_bulk_write_mock.assert_calls(2);
161161
stop_bulk_write_mock.assert();
162162
finalize_mock.assert();
163163
}
@@ -466,7 +466,7 @@ fn test_disk_create_fail() {
466466
.assert()
467467
.failure();
468468

469-
disk_view_mock.assert_hits(2);
469+
disk_view_mock.assert_calls(2);
470470
disk_create_mock.assert();
471471
}
472472

@@ -593,10 +593,10 @@ fn test_disk_write_import_fail() {
593593
.failure()
594594
.stderr(predicate::str::is_match(output).unwrap());
595595

596-
disk_view_mock.assert_hits(2);
596+
disk_view_mock.assert_calls(2);
597597
disk_create_mock.assert();
598598
start_bulk_write_mock.assert();
599-
disk_bulk_write_mock.assert_hits(2);
599+
disk_bulk_write_mock.assert_calls(2);
600600
}
601601

602602
// Test for required parameters being supplied

cli/tests/test_net.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ fn test_port_config() {
313313
mock_ports.assert();
314314
mock_lots.assert();
315315
mock_lot_blocks.assert();
316-
mock_bgp_configs.assert_hits(2);
316+
mock_bgp_configs.assert_calls(2);
317317
mock_switch0_qsfp0_settings_view.assert();
318318
mock_switch1_qsfp0_settings_view.assert();
319319
}

cli/tests/test_projects.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fn test_project_list_paginated() {
9090
mock_p1.assert();
9191
mock_p2.assert();
9292
// Because we hit the limit, we should not fetch the final page.
93-
mock_p3.assert_hits(0);
93+
mock_p3.assert_calls(0);
9494
}
9595

9696
#[test]

integration-tests/tests/test_extras.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async fn test_disk_import() {
113113
// Assert this endpoint before the next request to avoid defining an
114114
// expectation for whether this call should be made upon immediate
115115
// cancellation.
116-
disk_view_mock.assert_hits(2);
116+
disk_view_mock.assert_calls(2);
117117

118118
let (fut_to_cancel, handle) = client
119119
.disk_import()
@@ -133,9 +133,9 @@ async fn test_disk_import() {
133133
);
134134

135135
// No calls received for the cancelled request.
136-
disk_create_mock.assert_hits(2);
137-
start_bulk_write_mock.assert_hits(2);
138-
disk_bulk_write_mock.assert_hits(2);
139-
stop_bulk_write_mock.assert_hits(2);
140-
finalize_mock.assert_hits(2);
136+
disk_create_mock.assert_calls(2);
137+
start_bulk_write_mock.assert_calls(2);
138+
disk_bulk_write_mock.assert_calls(2);
139+
stop_bulk_write_mock.assert_calls(2);
140+
finalize_mock.assert_calls(2);
141141
}

0 commit comments

Comments
 (0)