@@ -41,12 +41,7 @@ async fn test_unknown_crate() {
41
41
let ( app, _, user) = TestApp :: full ( ) . with_user ( ) ;
42
42
app. db_new_user ( "bar" ) ;
43
43
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 ;
50
45
assert_eq ! ( response. status( ) , StatusCode :: NOT_FOUND ) ;
51
46
assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"crate `unknown` does not exist"}]}"# ) ;
52
47
}
@@ -58,10 +53,7 @@ async fn test_unknown_user() {
58
53
59
54
CrateBuilder :: new ( "foo" , cookie. as_model ( ) . id ) . expect_build ( & mut conn) ;
60
55
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 ;
65
57
assert_eq ! ( response. status( ) , StatusCode :: BAD_REQUEST ) ;
66
58
assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"could not find user with login `unknown`"}]}"# ) ;
67
59
}
@@ -73,9 +65,8 @@ async fn test_unknown_team() {
73
65
74
66
CrateBuilder :: new ( "foo" , cookie. as_model ( ) . id ) . expect_build ( & mut conn) ;
75
67
76
- let body = serde_json:: to_vec ( & json ! ( { "owners" : [ "github:unknown:unknown" ] } ) ) . unwrap ( ) ;
77
68
let response = cookie
78
- . delete_with_body :: < ( ) > ( "/api/v1/crates/ foo/owners ", body )
69
+ . remove_named_owner ( " foo", "github:unknown:unknown" )
79
70
. await ;
80
71
assert_eq ! ( response. status( ) , StatusCode :: BAD_REQUEST ) ;
81
72
assert_snapshot ! ( response. text( ) , @r#"{"errors":[{"detail":"could not find team with login `github:unknown:unknown`"}]}"# ) ;
0 commit comments