@@ -374,16 +374,15 @@ fn updating_existing_user_doesnt_change_api_token() {
374
374
assert_eq ! ( "bar_token" , user. gh_access_token) ;
375
375
}
376
376
377
- /* Given a GitHub user, check that if the user logs in,
378
- updates their email, logs out, then logs back in, the
379
- email they added to crates.io will not be overwritten
380
- by the information sent by GitHub.
381
-
382
- This bug is problematic if the user's email preferences
383
- are set to private on GitHub, as GitHub will always
384
- send none as the email and we will end up inadvertently
385
- deleting their email when they sign back in.
386
- */
377
+ /// Given a GitHub user, check that if the user logs in,
378
+ /// updates their email, logs out, then logs back in, the
379
+ /// email they added to crates.io will not be overwritten
380
+ /// by the information sent by GitHub.
381
+ ///
382
+ /// This bug is problematic if the user's email preferences
383
+ /// are set to private on GitHub, as GitHub will always
384
+ /// send none as the email and we will end up inadvertently
385
+ /// deleting their email when they sign back in.
387
386
#[ test]
388
387
fn github_without_email_does_not_overwrite_email ( ) {
389
388
let ( app, _) = TestApp :: init ( ) . empty ( ) ;
@@ -425,9 +424,8 @@ fn github_without_email_does_not_overwrite_email() {
425
424
assert_eq ! ( json. user. email. unwrap( ) , "apricot@apricots.apricot" ) ;
426
425
}
427
426
428
- /* Given a new user, test that if they sign in with one email, change their email on GitHub, then
429
- sign in again, that the email in crates.io will remain set to the original email used on GitHub.
430
- */
427
+ /// Given a new user, test that if they sign in with one email, change their email on GitHub, then
428
+ /// sign in again, that the email in crates.io will remain set to the original email used on GitHub.
431
429
#[ test]
432
430
fn github_with_email_does_not_overwrite_email ( ) {
433
431
use cargo_registry:: schema:: emails;
@@ -461,10 +459,9 @@ fn github_with_email_does_not_overwrite_email() {
461
459
assert_eq ! ( json. user. email, Some ( original_email) ) ;
462
460
}
463
461
464
- /* Given a crates.io user, check that the user's email can be
465
- updated in the database (PUT /user/:user_id), then check
466
- that the updated email is sent back to the user (GET /me).
467
- */
462
+ /// Given a crates.io user, check that the user's email can be
463
+ /// updated in the database (PUT /user/:user_id), then check
464
+ /// that the updated email is sent back to the user (GET /me).
468
465
#[ test]
469
466
fn test_email_get_and_put ( ) {
470
467
let ( _app, _anon, user) = TestApp :: init ( ) . with_user ( ) ;
@@ -480,16 +477,15 @@ fn test_email_get_and_put() {
480
477
assert ! ( json. user. email_verification_sent) ;
481
478
}
482
479
483
- /* Given a crates.io user, check to make sure that the user
484
- cannot add to the database an empty string or null as
485
- their email. If an attempt is made, update_user.rs will
486
- return an error indicating that an empty email cannot be
487
- added.
488
-
489
- This is checked on the frontend already, but I'd like to
490
- make sure that a user cannot get around that and delete
491
- their email by adding an empty string.
492
- */
480
+ /// Given a crates.io user, check to make sure that the user
481
+ /// cannot add to the database an empty string or null as
482
+ /// their email. If an attempt is made, update_user.rs will
483
+ /// return an error indicating that an empty email cannot be
484
+ /// added.
485
+ ///
486
+ /// This is checked on the frontend already, but I'd like to
487
+ /// make sure that a user cannot get around that and delete
488
+ /// their email by adding an empty string.
493
489
#[ test]
494
490
fn test_empty_email_not_added ( ) {
495
491
let ( _app, _anon, user) = TestApp :: init ( ) . with_user ( ) ;
@@ -510,12 +506,11 @@ fn test_empty_email_not_added() {
510
506
) ;
511
507
}
512
508
513
- /* Check to make sure that neither other signed in users nor anonymous users can edit another
514
- user's email address.
515
-
516
- If an attempt is made, update_user.rs will return an error indicating that the current user
517
- does not match the requested user.
518
- */
509
+ /// Check to make sure that neither other signed in users nor anonymous users can edit another
510
+ /// user's email address.
511
+ ///
512
+ /// If an attempt is made, update_user.rs will return an error indicating that the current user
513
+ /// does not match the requested user.
519
514
#[ test]
520
515
fn test_other_users_cannot_change_my_email ( ) {
521
516
let ( app, anon, user) = TestApp :: init ( ) . with_user ( ) ;
@@ -543,12 +538,11 @@ fn test_other_users_cannot_change_my_email() {
543
538
) ;
544
539
}
545
540
546
- /* Given a new user, test that their email can be added
547
- to the email table and a token for the email is generated
548
- and added to the token table. When /confirm/:email_token is
549
- requested, check that the response back is ok, and that
550
- the email_verified field on user is now set to true.
551
- */
541
+ /// Given a new user, test that their email can be added
542
+ /// to the email table and a token for the email is generated
543
+ /// and added to the token table. When /confirm/:email_token is
544
+ /// requested, check that the response back is ok, and that
545
+ /// the email_verified field on user is now set to true.
552
546
#[ test]
553
547
fn test_confirm_user_email ( ) {
554
548
use cargo_registry:: schema:: emails;
@@ -585,10 +579,9 @@ fn test_confirm_user_email() {
585
579
assert ! ( json. user. email_verification_sent) ;
586
580
}
587
581
588
- /* Given a user who existed before we added email confirmation,
589
- test that `email_verification_sent` is false so that we don't
590
- make the user think we've sent an email when we haven't.
591
- */
582
+ /// Given a user who existed before we added email confirmation,
583
+ /// test that `email_verification_sent` is false so that we don't
584
+ /// make the user think we've sent an email when we haven't.
592
585
#[ test]
593
586
fn test_existing_user_email ( ) {
594
587
use cargo_registry:: schema:: emails;
@@ -638,9 +631,8 @@ fn test_user_owned_crates_doesnt_include_deleted_ownership() {
638
631
assert_eq ! ( json. owned_crates. len( ) , 0 ) ;
639
632
}
640
633
641
- /* A user should be able to update the email notifications for crates they own. Only the crates that
642
- were sent in the request should be updated to the corresponding `email_notifications` value.
643
- */
634
+ /// A user should be able to update the email notifications for crates they own. Only the crates that
635
+ /// were sent in the request should be updated to the corresponding `email_notifications` value.
644
636
#[ test]
645
637
fn test_update_email_notifications ( ) {
646
638
let ( app, _, user) = TestApp :: init ( ) . with_user ( ) ;
@@ -723,9 +715,8 @@ fn test_update_email_notifications() {
723
715
} )
724
716
}
725
717
726
- /* A user should not be able to update the `email_notifications` value for a crate that is not
727
- owned by them.
728
- */
718
+ /// A user should not be able to update the `email_notifications` value for a crate that is not
719
+ /// owned by them.
729
720
#[ test]
730
721
fn test_update_email_notifications_not_owned ( ) {
731
722
let ( app, _, user) = TestApp :: init ( ) . with_user ( ) ;
0 commit comments