mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[SG-998] Move files to Vault folders (#2724)
* Move Api files * Move Core files * Move Infrastructure files * Move Sql Files * Move Api Sync files to Vault * Move test vault files * Update Sql.sqlproj paths * Update Codeowners * Fix vault file paths in sqlproj * Update CipherDetails.sql path in sqlproj * Update Core models and entities namespaces * Update namespaces Core Services and Repositories * Missed service namespaces * Update Api namespaces * Update Infrastructure namespaces * Move infrastructure queries that were missed * Tests namespace updates * Admin and Events namespace updates * Remove unused usings * Remove extra CiphersController usings * Rename folder * Fix CipherDetails namespace * Sqlproj fixes * Move stored procs into folders by table * using order fix
This commit is contained in:
45
test/Api.Test/Vault/Controllers/CiphersControllerTests.cs
Normal file
45
test/Api.Test/Vault/Controllers/CiphersControllerTests.cs
Normal file
@ -0,0 +1,45 @@
|
||||
using System.Security.Claims;
|
||||
using Bit.Api.Vault.Controllers;
|
||||
using Bit.Api.Vault.Models.Request;
|
||||
using Bit.Core.Services;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
using Bit.Core.Vault.Repositories;
|
||||
using Bit.Test.Common.AutoFixture;
|
||||
using Bit.Test.Common.AutoFixture.Attributes;
|
||||
using NSubstitute;
|
||||
using Xunit;
|
||||
|
||||
namespace Bit.Api.Test.Controllers;
|
||||
|
||||
[ControllerCustomize(typeof(CiphersController))]
|
||||
[SutProviderCustomize]
|
||||
public class CiphersControllerTests
|
||||
{
|
||||
[Theory, BitAutoData]
|
||||
public async Task PutPartialShouldReturnCipherWithGivenFolderAndFavoriteValues(Guid userId, Guid folderId, SutProvider<CiphersController> sutProvider)
|
||||
{
|
||||
var isFavorite = true;
|
||||
var cipherId = Guid.NewGuid();
|
||||
|
||||
sutProvider.GetDependency<IUserService>()
|
||||
.GetProperUserId(Arg.Any<ClaimsPrincipal>())
|
||||
.Returns(userId);
|
||||
|
||||
var cipherDetails = new CipherDetails
|
||||
{
|
||||
Favorite = isFavorite,
|
||||
FolderId = folderId,
|
||||
Type = Core.Vault.Enums.CipherType.SecureNote,
|
||||
Data = "{}"
|
||||
};
|
||||
|
||||
sutProvider.GetDependency<ICipherRepository>()
|
||||
.GetByIdAsync(cipherId, userId)
|
||||
.Returns(Task.FromResult(cipherDetails));
|
||||
|
||||
var result = await sutProvider.Sut.PutPartial(cipherId.ToString(), new CipherPartialRequestModel { Favorite = isFavorite, FolderId = folderId.ToString() });
|
||||
|
||||
Assert.Equal(folderId.ToString(), result.FolderId);
|
||||
Assert.Equal(isFavorite, result.Favorite);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user