Skip to content

Commit 2a7b437

Browse files
committed
axum: Update error snapshots
1 parent c88785e commit 2a7b437

8 files changed

+16
-16
lines changed

src/controllers/helpers/pagination.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -558,10 +558,10 @@ mod tests {
558558
fn page_param_parsing() {
559559
let error = |query| pagination_error(PaginationOptions::builder(), query);
560560

561-
assert_snapshot!(error("page="), @"Failed to deserialize query string: cannot parse integer from empty string");
562-
assert_snapshot!(error("page=not_a_number"), @"Failed to deserialize query string: invalid digit found in string");
563-
assert_snapshot!(error("page=1.0"), @"Failed to deserialize query string: invalid digit found in string");
564-
assert_snapshot!(error("page=0"), @"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32");
561+
assert_snapshot!(error("page="), @"Failed to deserialize query string: page: cannot parse integer from empty string");
562+
assert_snapshot!(error("page=not_a_number"), @"Failed to deserialize query string: page: invalid digit found in string");
563+
assert_snapshot!(error("page=1.0"), @"Failed to deserialize query string: page: invalid digit found in string");
564+
assert_snapshot!(error("page=0"), @"Failed to deserialize query string: page: invalid value: integer `0`, expected a nonzero u32");
565565

566566
let pagination = PaginationOptions::builder()
567567
.gather(&mock("page=5"))
@@ -573,11 +573,11 @@ mod tests {
573573
fn per_page_param_parsing() {
574574
let error = |query| pagination_error(PaginationOptions::builder(), query);
575575

576-
assert_snapshot!(error("per_page="), @"Failed to deserialize query string: cannot parse integer from empty string");
577-
assert_snapshot!(error("per_page=not_a_number"), @"Failed to deserialize query string: invalid digit found in string");
578-
assert_snapshot!(error("per_page=1.0"), @"Failed to deserialize query string: invalid digit found in string");
576+
assert_snapshot!(error("per_page="), @"Failed to deserialize query string: per_page: cannot parse integer from empty string");
577+
assert_snapshot!(error("per_page=not_a_number"), @"Failed to deserialize query string: per_page: invalid digit found in string");
578+
assert_snapshot!(error("per_page=1.0"), @"Failed to deserialize query string: per_page: invalid digit found in string");
579579
assert_snapshot!(error("per_page=101"), @"cannot request more than 100 items");
580-
assert_snapshot!(error("per_page=0"), @"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32");
580+
assert_snapshot!(error("per_page=0"), @"Failed to deserialize query string: per_page: invalid value: integer `0`, expected a nonzero u32");
581581

582582
let pagination = PaginationOptions::builder()
583583
.gather(&mock("per_page=5"))

src/tests/routes/crates/list.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,13 +1172,13 @@ async fn pagination_parameters_only_accept_integers() {
11721172
.get_with_query::<()>("/api/v1/crates", "page=1&per_page=100%22%EF%BC%8Cexception")
11731173
.await;
11741174
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
1175-
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid digit found in string"}]}"#);
1175+
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: per_page: invalid digit found in string"}]}"#);
11761176

11771177
let response = anon
11781178
.get_with_query::<()>("/api/v1/crates", "page=100%22%EF%BC%8Cexception&per_page=1")
11791179
.await;
11801180
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
1181-
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid digit found in string"}]}"#);
1181+
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: page: invalid digit found in string"}]}"#);
11821182
}
11831183

11841184
#[tokio::test(flavor = "multi_thread")]

src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-2.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: response.json()
55
{
66
"errors": [
77
{
8-
"detail": "Failed to deserialize query string: string contains null byte"
8+
"detail": "Failed to deserialize query string: category: string contains null byte"
99
}
1010
]
1111
}

src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-3.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: response.json()
55
{
66
"errors": [
77
{
8-
"detail": "Failed to deserialize query string: string contains null byte"
8+
"detail": "Failed to deserialize query string: all_keywords: string contains null byte"
99
}
1010
]
1111
}

src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-4.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: response.json()
55
{
66
"errors": [
77
{
8-
"detail": "Failed to deserialize query string: string contains null byte"
8+
"detail": "Failed to deserialize query string: keyword: string contains null byte"
99
}
1010
]
1111
}

src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes-5.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: response.json()
55
{
66
"errors": [
77
{
8-
"detail": "Failed to deserialize query string: string contains null byte"
8+
"detail": "Failed to deserialize query string: letter: string contains null byte"
99
}
1010
]
1111
}

src/tests/routes/crates/snapshots/crates_io__tests__routes__crates__list__invalid_params_with_null_bytes.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ expression: response.json()
55
{
66
"errors": [
77
{
8-
"detail": "Failed to deserialize query string: string contains null byte"
8+
"detail": "Failed to deserialize query string: q: string contains null byte"
99
}
1010
]
1111
}

src/tests/routes/me/updates.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,5 +103,5 @@ async fn following() {
103103
.get_with_query::<()>("/api/v1/me/updates", "page=0")
104104
.await;
105105
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
106-
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: invalid value: integer `0`, expected a nonzero u32"}]}"#);
106+
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"Failed to deserialize query string: page: invalid value: integer `0`, expected a nonzero u32"}]}"#);
107107
}

0 commit comments

Comments
 (0)