@@ -1194,3 +1194,59 @@ def test_revoke_invitation(
11941194 )
11951195 assert request_kwargs ["method" ] == "post"
11961196 assert isinstance (invitation , Invitation )
1197+
1198+ def test_resend_invitation (
1199+ self , capture_and_mock_http_client_request , mock_invitation
1200+ ):
1201+ request_kwargs = capture_and_mock_http_client_request (
1202+ self .http_client , mock_invitation , 200
1203+ )
1204+
1205+ invitation = syncify (self .user_management .resend_invitation ("invitation_ABCDE" ))
1206+
1207+ assert request_kwargs ["url" ].endswith (
1208+ "user_management/invitations/invitation_ABCDE/resend"
1209+ )
1210+ assert request_kwargs ["method" ] == "post"
1211+ assert isinstance (invitation , Invitation )
1212+ assert invitation .id == "invitation_ABCDE"
1213+
1214+ def test_resend_invitation_not_found (self , capture_and_mock_http_client_request ):
1215+ error_response = {
1216+ "message" : "Invitation not found" ,
1217+ "code" : "not_found" ,
1218+ }
1219+ capture_and_mock_http_client_request (self .http_client , error_response , 404 )
1220+
1221+ with pytest .raises (Exception ):
1222+ syncify (self .user_management .resend_invitation ("invitation_nonexistent" ))
1223+
1224+ def test_resend_invitation_expired (self , capture_and_mock_http_client_request ):
1225+ error_response = {
1226+ "message" : "Invite has expired." ,
1227+ "code" : "invite_expired" ,
1228+ }
1229+ capture_and_mock_http_client_request (self .http_client , error_response , 400 )
1230+
1231+ with pytest .raises (Exception ):
1232+ syncify (self .user_management .resend_invitation ("invitation_expired" ))
1233+
1234+ def test_resend_invitation_revoked (self , capture_and_mock_http_client_request ):
1235+ error_response = {
1236+ "message" : "Invite has been revoked." ,
1237+ "code" : "invite_revoked" ,
1238+ }
1239+ capture_and_mock_http_client_request (self .http_client , error_response , 400 )
1240+
1241+ with pytest .raises (Exception ):
1242+ syncify (self .user_management .resend_invitation ("invitation_revoked" ))
1243+
1244+ def test_resend_invitation_accepted (self , capture_and_mock_http_client_request ):
1245+ error_response = {
1246+ "message" : "Invite has already been accepted." ,
1247+ "code" : "invite_accepted" ,
1248+ }
1249+ capture_and_mock_http_client_request (self .http_client , error_response , 400 )
1250+
1251+ with pytest .raises (Exception ):
1252+ syncify (self .user_management .resend_invitation ("invitation_accepted" ))
0 commit comments