@@ -3,34 +3,22 @@ use crate::util::{RequestHelper, TestApp};
3
3
use crate :: OkBool ;
4
4
use http:: StatusCode ;
5
5
6
- impl crate :: util :: MockTokenUser {
6
+ trait YankRequestHelper {
7
7
/// Yank the specified version of the specified crate and run all pending background jobs
8
- fn yank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > {
9
- let url = format ! ( "/api/v1/crates/{krate_name}/{version}/yank" ) ;
10
- let response = self . delete ( & url) ;
11
- self . app ( ) . run_pending_background_jobs ( ) ;
12
- response
13
- }
8
+ fn yank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > ;
14
9
15
10
/// Unyank the specified version of the specified crate and run all pending background jobs
16
- fn unyank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > {
17
- let url = format ! ( "/api/v1/crates/{krate_name}/{version}/unyank" ) ;
18
- let response = self . put ( & url, & [ ] ) ;
19
- self . app ( ) . run_pending_background_jobs ( ) ;
20
- response
21
- }
11
+ fn unyank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > ;
22
12
}
23
13
24
- impl crate :: util:: MockCookieUser {
25
- /// Yank the specified version of the specified crate and run all pending background jobs
14
+ impl < T : RequestHelper > YankRequestHelper for T {
26
15
fn yank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > {
27
16
let url = format ! ( "/api/v1/crates/{krate_name}/{version}/yank" ) ;
28
17
let response = self . delete ( & url) ;
29
18
self . app ( ) . run_pending_background_jobs ( ) ;
30
19
response
31
20
}
32
21
33
- /// Unyank the specified version of the specified crate and run all pending background jobs
34
22
fn unyank ( & self , krate_name : & str , version : & str ) -> crate :: util:: Response < OkBool > {
35
23
let url = format ! ( "/api/v1/crates/{krate_name}/{version}/unyank" ) ;
36
24
let response = self . put ( & url, & [ ] ) ;
0 commit comments