@@ -221,6 +221,33 @@ pub trait RequestHelper {
221221 let url = "/api/v1/categories" ;
222222 self . get ( url) . await . good ( )
223223 }
224+
225+ /// Add to the specified crate the specified owners.
226+ async fn add_named_owners < T > ( & self , krate_name : & str , owners : & [ T ] ) -> Response < OkBool >
227+ where
228+ T : serde:: Serialize ,
229+ {
230+ let url = format ! ( "/api/v1/crates/{krate_name}/owners" ) ;
231+ let body = json ! ( { "owners" : owners } ) . to_string ( ) ;
232+ self . put ( & url, body) . await
233+ }
234+
235+ /// Add a single owner to the specified crate.
236+ async fn add_named_owner ( & self , krate_name : & str , owner : & str ) -> Response < OkBool > {
237+ self . add_named_owners ( krate_name, & [ owner] ) . await
238+ }
239+
240+ /// Remove from the specified crate the specified owners.
241+ async fn remove_named_owners ( & self , krate_name : & str , owners : & [ & str ] ) -> Response < OkBool > {
242+ let url = format ! ( "/api/v1/crates/{krate_name}/owners" ) ;
243+ let body = json ! ( { "owners" : owners } ) . to_string ( ) ;
244+ self . delete_with_body ( & url, body) . await
245+ }
246+
247+ /// Remove a single owner to the specified crate.
248+ async fn remove_named_owner ( & self , krate_name : & str , owner : & str ) -> Response < OkBool > {
249+ self . remove_named_owners ( krate_name, & [ owner] ) . await
250+ }
224251}
225252
226253fn req ( method : Method , path : & str ) -> MockRequest {
@@ -345,31 +372,4 @@ impl MockTokenUser {
345372 pub fn plaintext ( & self ) -> & PlainToken {
346373 & self . token . plaintext
347374 }
348-
349- /// Add to the specified crate the specified owners.
350- pub async fn add_named_owners < T > ( & self , krate_name : & str , owners : & [ T ] ) -> Response < OkBool >
351- where
352- T : serde:: Serialize ,
353- {
354- let url = format ! ( "/api/v1/crates/{krate_name}/owners" ) ;
355- let body = json ! ( { "owners" : owners } ) . to_string ( ) ;
356- self . put ( & url, body) . await
357- }
358-
359- /// Add a single owner to the specified crate.
360- pub async fn add_named_owner ( & self , krate_name : & str , owner : & str ) -> Response < OkBool > {
361- self . add_named_owners ( krate_name, & [ owner] ) . await
362- }
363-
364- /// Remove from the specified crate the specified owners.
365- pub async fn remove_named_owners ( & self , krate_name : & str , owners : & [ & str ] ) -> Response < OkBool > {
366- let url = format ! ( "/api/v1/crates/{krate_name}/owners" ) ;
367- let body = json ! ( { "owners" : owners } ) . to_string ( ) ;
368- self . delete_with_body ( & url, body) . await
369- }
370-
371- /// Remove a single owner to the specified crate.
372- pub async fn remove_named_owner ( & self , krate_name : & str , owner : & str ) -> Response < OkBool > {
373- self . remove_named_owners ( krate_name, & [ owner] ) . await
374- }
375375}
0 commit comments