@@ -452,60 +452,10 @@ await sutProvider.GetDependency<IOrganizationService>().Received(0)
452452
453453 [ Theory ]
454454 [ BitAutoData ]
455- public async Task PutResetPassword_WithFeatureFlagDisabled_CallsLegacyPath (
455+ public async Task PutResetPassword_WhenOrganizationUserNotFound_ReturnsNotFound (
456456 Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model ,
457457 SutProvider < OrganizationUsersController > sutProvider )
458458 {
459- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( false ) ;
460- sutProvider . GetDependency < ICurrentContext > ( ) . OrganizationOwner ( orgId ) . Returns ( true ) ;
461- sutProvider . GetDependency < IUserService > ( ) . AdminResetPasswordAsync ( Arg . Any < OrganizationUserType > ( ) , orgId , orgUserId , model . NewMasterPasswordHash , model . Key )
462- . Returns ( Microsoft . AspNetCore . Identity . IdentityResult . Success ) ;
463-
464- var result = await sutProvider . Sut . PutResetPassword ( orgId , orgUserId , model ) ;
465-
466- Assert . IsType < Ok > ( result ) ;
467- await sutProvider . GetDependency < IUserService > ( ) . Received ( 1 )
468- . AdminResetPasswordAsync ( OrganizationUserType . Owner , orgId , orgUserId , model . NewMasterPasswordHash , model . Key ) ;
469- }
470-
471- [ Theory ]
472- [ BitAutoData ]
473- public async Task PutResetPassword_WithFeatureFlagDisabled_WhenOrgUserTypeIsNull_ReturnsNotFound (
474- Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model ,
475- SutProvider < OrganizationUsersController > sutProvider )
476- {
477- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( false ) ;
478- sutProvider . GetDependency < ICurrentContext > ( ) . OrganizationOwner ( orgId ) . Returns ( false ) ;
479- sutProvider . GetDependency < ICurrentContext > ( ) . Organizations . Returns ( new List < CurrentContextOrganization > ( ) ) ;
480-
481- var result = await sutProvider . Sut . PutResetPassword ( orgId , orgUserId , model ) ;
482-
483- Assert . IsType < Microsoft . AspNetCore . Http . HttpResults . NotFound > ( result ) ;
484- }
485-
486- [ Theory ]
487- [ BitAutoData ]
488- public async Task PutResetPassword_WithFeatureFlagDisabled_WhenAdminResetPasswordFails_ReturnsBadRequest (
489- Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model ,
490- SutProvider < OrganizationUsersController > sutProvider )
491- {
492- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( false ) ;
493- sutProvider . GetDependency < ICurrentContext > ( ) . OrganizationOwner ( orgId ) . Returns ( true ) ;
494- sutProvider . GetDependency < IUserService > ( ) . AdminResetPasswordAsync ( Arg . Any < OrganizationUserType > ( ) , orgId , orgUserId , model . NewMasterPasswordHash , model . Key )
495- . Returns ( Microsoft . AspNetCore . Identity . IdentityResult . Failed ( new Microsoft . AspNetCore . Identity . IdentityError { Description = "Error 1" } ) ) ;
496-
497- var result = await sutProvider . Sut . PutResetPassword ( orgId , orgUserId , model ) ;
498-
499- Assert . IsType < BadRequest < ModelStateDictionary > > ( result ) ;
500- }
501-
502- [ Theory ]
503- [ BitAutoData ]
504- public async Task PutResetPassword_WithFeatureFlagEnabled_WhenOrganizationUserNotFound_ReturnsNotFound (
505- Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model ,
506- SutProvider < OrganizationUsersController > sutProvider )
507- {
508- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( true ) ;
509459 sutProvider . GetDependency < IOrganizationUserRepository > ( ) . GetByIdAsync ( orgUserId ) . Returns ( ( OrganizationUser ) null ) ;
510460
511461 var result = await sutProvider . Sut . PutResetPassword ( orgId , orgUserId , model ) ;
@@ -515,12 +465,11 @@ public async Task PutResetPassword_WithFeatureFlagEnabled_WhenOrganizationUserNo
515465
516466 [ Theory ]
517467 [ BitAutoData ]
518- public async Task PutResetPassword_WithFeatureFlagEnabled_WhenOrganizationIdMismatch_ReturnsNotFound (
468+ public async Task PutResetPassword_WhenOrganizationIdMismatch_ReturnsNotFound (
519469 Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model , OrganizationUser organizationUser ,
520470 SutProvider < OrganizationUsersController > sutProvider )
521471 {
522472 organizationUser . OrganizationId = Guid . NewGuid ( ) ;
523- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( true ) ;
524473 sutProvider . GetDependency < IOrganizationUserRepository > ( ) . GetByIdAsync ( orgUserId ) . Returns ( organizationUser ) ;
525474
526475 var result = await sutProvider . Sut . PutResetPassword ( orgId , orgUserId , model ) ;
@@ -530,12 +479,11 @@ public async Task PutResetPassword_WithFeatureFlagEnabled_WhenOrganizationIdMism
530479
531480 [ Theory ]
532481 [ BitAutoData ]
533- public async Task PutResetPassword_WithFeatureFlagEnabled_WhenAuthorizationFails_ReturnsBadRequest (
482+ public async Task PutResetPassword_WhenAuthorizationFails_ReturnsBadRequest (
534483 Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model , OrganizationUser organizationUser ,
535484 SutProvider < OrganizationUsersController > sutProvider )
536485 {
537486 organizationUser . OrganizationId = orgId ;
538- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( true ) ;
539487 sutProvider . GetDependency < IOrganizationUserRepository > ( ) . GetByIdAsync ( orgUserId ) . Returns ( organizationUser ) ;
540488 sutProvider . GetDependency < IAuthorizationService > ( )
541489 . AuthorizeAsync (
@@ -551,12 +499,11 @@ public async Task PutResetPassword_WithFeatureFlagEnabled_WhenAuthorizationFails
551499
552500 [ Theory ]
553501 [ BitAutoData ]
554- public async Task PutResetPassword_WithFeatureFlagEnabled_WhenRecoverAccountSucceeds_ReturnsOk (
502+ public async Task PutResetPassword_WhenRecoverAccountSucceeds_ReturnsOk (
555503 Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model , OrganizationUser organizationUser ,
556504 SutProvider < OrganizationUsersController > sutProvider )
557505 {
558506 organizationUser . OrganizationId = orgId ;
559- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( true ) ;
560507 sutProvider . GetDependency < IOrganizationUserRepository > ( ) . GetByIdAsync ( orgUserId ) . Returns ( organizationUser ) ;
561508 sutProvider . GetDependency < IAuthorizationService > ( )
562509 . AuthorizeAsync (
@@ -577,12 +524,11 @@ await sutProvider.GetDependency<IAdminRecoverAccountCommand>().Received(1)
577524
578525 [ Theory ]
579526 [ BitAutoData ]
580- public async Task PutResetPassword_WithFeatureFlagEnabled_WhenRecoverAccountFails_ReturnsBadRequest (
527+ public async Task PutResetPassword_WhenRecoverAccountFails_ReturnsBadRequest (
581528 Guid orgId , Guid orgUserId , OrganizationUserResetPasswordRequestModel model , OrganizationUser organizationUser ,
582529 SutProvider < OrganizationUsersController > sutProvider )
583530 {
584531 organizationUser . OrganizationId = orgId ;
585- sutProvider . GetDependency < IFeatureService > ( ) . IsEnabled ( FeatureFlagKeys . AccountRecoveryCommand ) . Returns ( true ) ;
586532 sutProvider . GetDependency < IOrganizationUserRepository > ( ) . GetByIdAsync ( orgUserId ) . Returns ( organizationUser ) ;
587533 sutProvider . GetDependency < IAuthorizationService > ( )
588534 . AuthorizeAsync (
0 commit comments