mirror of
https://github.com/bitwarden/server.git
synced 2025-06-20 02:48:03 -05:00
Fix tests
This commit is contained in:
parent
ee857ed0e5
commit
18c562db6f
@ -159,7 +159,7 @@ public class RotateUserAccountKeysCommand(
|
|||||||
{
|
{
|
||||||
await ValidateRotationModelSignatureKeyPairForV2User(model, user);
|
await ValidateRotationModelSignatureKeyPairForV2User(model, user);
|
||||||
}
|
}
|
||||||
else
|
else if (model.AccountKeys.SignatureKeyPairData != null)
|
||||||
{
|
{
|
||||||
ValidateRotationModelSignatureKeyPairForV1UserAndUpgradeToV2(model, user, saveEncryptedDataActions);
|
ValidateRotationModelSignatureKeyPairForV1UserAndUpgradeToV2(model, user, saveEncryptedDataActions);
|
||||||
}
|
}
|
||||||
|
@ -112,13 +112,15 @@ public class RotateUserAccountKeysCommandTests
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Theory, BitAutoData]
|
[Theory, BitAutoData]
|
||||||
public async Task RotatesCorrectly(SutProvider<RotateUserAccountKeysCommand> sutProvider, User user,
|
public async Task RotatesCorrectlyV1Async(SutProvider<RotateUserAccountKeysCommand> sutProvider, User user,
|
||||||
RotateUserAccountKeysData model)
|
RotateUserAccountKeysData model)
|
||||||
{
|
{
|
||||||
user.Kdf = Enums.KdfType.Argon2id;
|
user.Kdf = Enums.KdfType.Argon2id;
|
||||||
user.KdfIterations = 3;
|
user.KdfIterations = 3;
|
||||||
user.KdfMemory = 64;
|
user.KdfMemory = 64;
|
||||||
user.KdfParallelism = 4;
|
user.KdfParallelism = 4;
|
||||||
|
user.PrivateKey = "2.xxx";
|
||||||
|
user.SignedPublicKey = null;
|
||||||
|
|
||||||
model.MasterPasswordUnlockData.Email = user.Email;
|
model.MasterPasswordUnlockData.Email = user.Email;
|
||||||
model.MasterPasswordUnlockData.KdfType = Enums.KdfType.Argon2id;
|
model.MasterPasswordUnlockData.KdfType = Enums.KdfType.Argon2id;
|
||||||
@ -127,6 +129,8 @@ public class RotateUserAccountKeysCommandTests
|
|||||||
model.MasterPasswordUnlockData.KdfParallelism = 4;
|
model.MasterPasswordUnlockData.KdfParallelism = 4;
|
||||||
|
|
||||||
model.AccountPublicKey = user.PublicKey;
|
model.AccountPublicKey = user.PublicKey;
|
||||||
|
model.UserKeyEncryptedAccountPrivateKey = "2.xxx";
|
||||||
|
model.AccountKeys.SignatureKeyPairData = null;
|
||||||
|
|
||||||
sutProvider.GetDependency<IUserService>().CheckPasswordAsync(user, model.OldMasterKeyAuthenticationHash)
|
sutProvider.GetDependency<IUserService>().CheckPasswordAsync(user, model.OldMasterKeyAuthenticationHash)
|
||||||
.Returns(true);
|
.Returns(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user