You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #3061 - Turbo87:status, r=pietroalbini
tests/util: Replace `Response::assert_status()` with `Response::status()`
`Response::status()` seems easier to use to me and doesn't hide the actual assertion. It also allows us to access things like `StatusCode::is_success()` directly.
r? `@jtgeibel`
let crate_to_publish = PublishBuilder::new("foo_no_email");
591
591
592
592
let response = token.enqueue_publish(crate_to_publish);
593
-
response.assert_status(StatusCode::OK);
593
+
assert_eq!(response.status(),StatusCode::OK);
594
594
assert_eq!(
595
595
response.json(),
596
596
json!({"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/me to set and verify your email address."}]})
let crate_to_publish = PublishBuilder::new("foo_unverified_email");
612
612
613
613
let response = token.enqueue_publish(crate_to_publish);
614
-
response.assert_status(StatusCode::OK);
614
+
assert_eq!(response.status(),StatusCode::OK);
615
615
assert_eq!(
616
616
response.json(),
617
617
json!({"errors":[{"detail":"A verified email address is required to publish crates to crates.io. Visit https://crates.io/me to set and verify your email address."}]})
Copy file name to clipboardExpand all lines: src/tests/owners.rs
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -136,7 +136,7 @@ fn owners_can_remove_self() {
136
136
137
137
// Deleting yourself when you're the only owner isn't allowed.
138
138
let response = token.remove_named_owner("owners_selfremove", username);
139
-
response.assert_status(StatusCode::OK);
139
+
assert_eq!(response.status(),StatusCode::OK);
140
140
assert_eq!(
141
141
response.json(),
142
142
json!({"errors":[{"detail":"cannot remove all individual owners of a crate. Team member don't have permission to modify owners, so at least one individual owner is required."}]})
// After you delete yourself, you no longer have permisions to manage the crate.
156
156
let response = token.remove_named_owner("owners_selfremove", username);
157
-
response.assert_status(StatusCode::OK);
157
+
assert_eq!(response.status(),StatusCode::OK);
158
158
assert_eq!(
159
159
response.json(),
160
160
json!({"errors":[{"detail":"only owners have permission to modify owners"}]})
@@ -175,7 +175,7 @@ fn modify_multiple_owners() {
175
175
176
176
// Deleting all owners is not allowed.
177
177
let response = token.remove_named_owners("owners_multiple",&[username,"user2","user3"]);
178
-
response.assert_status(StatusCode::OK);
178
+
assert_eq!(response.status(),StatusCode::OK);
179
179
assert_eq!(
180
180
response.json(),
181
181
json!({"errors":[{"detail":"cannot remove all individual owners of a crate. Team member don't have permission to modify owners, so at least one individual owner is required."}]})
@@ -184,7 +184,7 @@ fn modify_multiple_owners() {
184
184
185
185
// Deleting two owners at once is allowed.
186
186
let response = token.remove_named_owners("owners_multiple",&["user2","user3"]);
0 commit comments