mirror of
https://github.com/bitwarden/server
synced 2025-12-10 13:23:27 +00:00
[PM-19151] [PM-19161] Innovation/archive/server (#5672)
* Added the ArchivedDate to cipher entity and response model * Created migration scripts for sqlserver and ef core migration to add the ArchivedDate column --------- Co-authored-by: gbubemismith <gsmithwalter@gmail.com> Co-authored-by: SmithThe4th <gsmith@bitwarden.com> Co-authored-by: Shane <smelton@bitwarden.com> Co-authored-by: cd-bitwarden <106776772+cd-bitwarden@users.noreply.github.com> Co-authored-by: jng <jng@bitwarden.com>
This commit is contained in:
committed by
GitHub
parent
18aed0bd79
commit
4e64d35f89
@@ -1211,4 +1211,34 @@ public class CipherRepositoryTests
|
||||
|
||||
Assert.Null(deletedCipher2);
|
||||
}
|
||||
|
||||
[DatabaseTheory, DatabaseData]
|
||||
public async Task ArchiveAsync_Works(
|
||||
ICipherRepository sutRepository,
|
||||
IUserRepository userRepository)
|
||||
{
|
||||
var user = await userRepository.CreateAsync(new User
|
||||
{
|
||||
Name = "Test User",
|
||||
Email = $"test+{Guid.NewGuid()}@email.com",
|
||||
ApiKey = "TEST",
|
||||
SecurityStamp = "stamp",
|
||||
});
|
||||
|
||||
// Ciphers
|
||||
var cipher = await sutRepository.CreateAsync(new Cipher
|
||||
{
|
||||
Type = CipherType.Login,
|
||||
Data = "",
|
||||
UserId = user.Id
|
||||
});
|
||||
|
||||
// Act
|
||||
await sutRepository.ArchiveAsync(new List<Guid> { cipher.Id }, user.Id);
|
||||
|
||||
// Assert
|
||||
var archivedCipher = await sutRepository.GetByIdAsync(cipher.Id, user.Id);
|
||||
Assert.NotNull(archivedCipher);
|
||||
Assert.NotNull(archivedCipher.ArchivedDate);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user