mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
Auth/PM-11945 - Registration with Email Verification - Fix Org Sponsored Free Family Plan not working (#4772)
* PM-11945 - Rename RegisterUserWithOptionalOrgInvite to RegisterUserViaOrgInvite as the org invite isn't optional in the function - just the overall process of registration. * PM-11945 - Yet another rename * PM-11945 - Wire up call to RegisterUserViaOrgSponsoredFreeFamilyPlanInviteToken and test. * PM-11945 - RegisterUserCommandTests - test new method * PM-11949 - Rename tests * PM-11945 - AccountsControllerTests.cs - add integration test for RegistrationWithEmailVerification_WithOrgSponsoredFreeFamilyPlanInviteToken_Succeeds * PM-11945 - Adjust naming per PR feedback to match docs. * PM-11945 - More renaming
This commit is contained in:
@ -111,7 +111,7 @@ public class AccountsControllerTests : IDisposable
|
||||
var passwordHash = "abcdef";
|
||||
var token = "123456";
|
||||
var userGuid = new Guid();
|
||||
_registerUserCommand.RegisterUserWithOptionalOrgInvite(Arg.Any<User>(), passwordHash, token, userGuid)
|
||||
_registerUserCommand.RegisterUserViaOrganizationInviteToken(Arg.Any<User>(), passwordHash, token, userGuid)
|
||||
.Returns(Task.FromResult(IdentityResult.Success));
|
||||
var request = new RegisterRequestModel
|
||||
{
|
||||
@ -125,7 +125,7 @@ public class AccountsControllerTests : IDisposable
|
||||
|
||||
await _sut.PostRegister(request);
|
||||
|
||||
await _registerUserCommand.Received(1).RegisterUserWithOptionalOrgInvite(Arg.Any<User>(), passwordHash, token, userGuid);
|
||||
await _registerUserCommand.Received(1).RegisterUserViaOrganizationInviteToken(Arg.Any<User>(), passwordHash, token, userGuid);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -134,7 +134,7 @@ public class AccountsControllerTests : IDisposable
|
||||
var passwordHash = "abcdef";
|
||||
var token = "123456";
|
||||
var userGuid = new Guid();
|
||||
_registerUserCommand.RegisterUserWithOptionalOrgInvite(Arg.Any<User>(), passwordHash, token, userGuid)
|
||||
_registerUserCommand.RegisterUserViaOrganizationInviteToken(Arg.Any<User>(), passwordHash, token, userGuid)
|
||||
.Returns(Task.FromResult(IdentityResult.Failed()));
|
||||
var request = new RegisterRequestModel
|
||||
{
|
||||
@ -219,7 +219,7 @@ public class AccountsControllerTests : IDisposable
|
||||
|
||||
var user = model.ToUser();
|
||||
|
||||
_registerUserCommand.RegisterUserWithOptionalOrgInvite(Arg.Any<User>(), masterPasswordHash, orgInviteToken, organizationUserId)
|
||||
_registerUserCommand.RegisterUserViaOrganizationInviteToken(Arg.Any<User>(), masterPasswordHash, orgInviteToken, organizationUserId)
|
||||
.Returns(Task.FromResult(IdentityResult.Success));
|
||||
|
||||
// Act
|
||||
@ -227,7 +227,7 @@ public class AccountsControllerTests : IDisposable
|
||||
|
||||
// Assert
|
||||
Assert.NotNull(result);
|
||||
await _registerUserCommand.Received(1).RegisterUserWithOptionalOrgInvite(Arg.Is<User>(u =>
|
||||
await _registerUserCommand.Received(1).RegisterUserViaOrganizationInviteToken(Arg.Is<User>(u =>
|
||||
u.Email == user.Email &&
|
||||
u.MasterPasswordHint == user.MasterPasswordHint &&
|
||||
u.Kdf == user.Kdf &&
|
||||
@ -270,7 +270,7 @@ public class AccountsControllerTests : IDisposable
|
||||
new IdentityError { Code = duplicateUserEmailErrorCode, Description = duplicateUserEmailErrorDesc }
|
||||
);
|
||||
|
||||
_registerUserCommand.RegisterUserWithOptionalOrgInvite(Arg.Is<User>(u =>
|
||||
_registerUserCommand.RegisterUserViaOrganizationInviteToken(Arg.Is<User>(u =>
|
||||
u.Email == user.Email &&
|
||||
u.MasterPasswordHint == user.MasterPasswordHint &&
|
||||
u.Kdf == user.Kdf &&
|
||||
|
Reference in New Issue
Block a user