@@ -55,6 +55,11 @@ impl crate::util::MockCookieUser {
55
55
assert ! ( crate_owner_invite. crate_owner_invitation. accepted) ;
56
56
assert_eq ! ( crate_owner_invite. crate_owner_invitation. crate_id, krate_id) ;
57
57
}
58
+
59
+ /// As the currently logged in user, list my pending invitations.
60
+ fn list_invitations ( & self ) -> InvitationListResponse {
61
+ self . get ( "/api/v1/me/crate_owner_invitations" ) . good ( )
62
+ }
58
63
}
59
64
60
65
#[ test]
@@ -191,7 +196,7 @@ fn check_ownership_one_crate() {
191
196
fn invitations_are_empty_by_default ( ) {
192
197
let ( _, _, user) = TestApp :: init ( ) . with_user ( ) ;
193
198
194
- let json: InvitationListResponse = user. get ( "/api/v1/me/crate_owner_invitations" ) . good ( ) ;
199
+ let json = user. list_invitations ( ) ;
195
200
assert_eq ! ( json. crate_owner_invitations. len( ) , 0 ) ;
196
201
}
197
202
@@ -205,7 +210,7 @@ fn invitations_list() {
205
210
let user = app. db_new_user ( "invited_user" ) ;
206
211
token. add_user_owner ( "invited_crate" , user. as_model ( ) ) ;
207
212
208
- let json: InvitationListResponse = user. get ( "/api/v1/me/crate_owner_invitations" ) . good ( ) ;
213
+ let json = user. list_invitations ( ) ;
209
214
assert_eq ! ( json. crate_owner_invitations. len( ) , 1 ) ;
210
215
assert_eq ! (
211
216
json. crate_owner_invitations[ 0 ] . invited_by_username,
0 commit comments