Skip to content

Commit d97bb62

Browse files
committed
tests/routes/crates/owners/remove: Use remove_named_owner() helper fn
1 parent 5c394bd commit d97bb62

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/tests/routes/crates/owners/remove.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,7 @@ async fn test_unknown_crate() {
4141
let (app, _, user) = TestApp::full().with_user();
4242
app.db_new_user("bar");
4343

44-
let body = json!({ "owners": ["bar"] });
45-
let body = serde_json::to_vec(&body).unwrap();
46-
47-
let response = user
48-
.delete_with_body::<()>("/api/v1/crates/unknown/owners", body)
49-
.await;
44+
let response = user.remove_named_owner("unknown", "bar").await;
5045
assert_eq!(response.status(), StatusCode::NOT_FOUND);
5146
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"crate `unknown` does not exist"}]}"#);
5247
}
@@ -58,10 +53,7 @@ async fn test_unknown_user() {
5853

5954
CrateBuilder::new("foo", cookie.as_model().id).expect_build(&mut conn);
6055

61-
let body = serde_json::to_vec(&json!({ "owners": ["unknown"] })).unwrap();
62-
let response = cookie
63-
.delete_with_body::<()>("/api/v1/crates/foo/owners", body)
64-
.await;
56+
let response = cookie.remove_named_owner("foo", "unknown").await;
6557
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
6658
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"could not find user with login `unknown`"}]}"#);
6759
}
@@ -73,9 +65,8 @@ async fn test_unknown_team() {
7365

7466
CrateBuilder::new("foo", cookie.as_model().id).expect_build(&mut conn);
7567

76-
let body = serde_json::to_vec(&json!({ "owners": ["github:unknown:unknown"] })).unwrap();
7768
let response = cookie
78-
.delete_with_body::<()>("/api/v1/crates/foo/owners", body)
69+
.remove_named_owner("foo", "github:unknown:unknown")
7970
.await;
8071
assert_eq!(response.status(), StatusCode::BAD_REQUEST);
8172
assert_snapshot!(response.text(), @r#"{"errors":[{"detail":"could not find team with login `github:unknown:unknown`"}]}"#);

0 commit comments

Comments
 (0)