mirror of
https://github.com/bitwarden/server.git
synced 2024-11-30 13:33:24 +01:00
3289a8c35e
* 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
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using AutoFixture;
|
|
using Bit.Core.Vault.Entities;
|
|
using Bit.Core.Vault.Models.Data;
|
|
using Bit.Test.Common.AutoFixture.Attributes;
|
|
|
|
namespace Bit.Core.Test.AutoFixture.CipherFixtures;
|
|
|
|
internal class OrganizationCipher : ICustomization
|
|
{
|
|
public Guid? OrganizationId { get; set; }
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<Cipher>(composer => composer
|
|
.With(c => c.OrganizationId, OrganizationId ?? Guid.NewGuid())
|
|
.Without(c => c.UserId));
|
|
fixture.Customize<CipherDetails>(composer => composer
|
|
.With(c => c.OrganizationId, Guid.NewGuid())
|
|
.Without(c => c.UserId));
|
|
}
|
|
}
|
|
|
|
internal class UserCipher : ICustomization
|
|
{
|
|
public Guid? UserId { get; set; }
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<Cipher>(composer => composer
|
|
.With(c => c.UserId, UserId ?? Guid.NewGuid())
|
|
.Without(c => c.OrganizationId));
|
|
fixture.Customize<CipherDetails>(composer => composer
|
|
.With(c => c.UserId, Guid.NewGuid())
|
|
.Without(c => c.OrganizationId));
|
|
}
|
|
}
|
|
|
|
internal class UserCipherCustomizeAttribute : BitCustomizeAttribute
|
|
{
|
|
public override ICustomization GetCustomization() => new UserCipher();
|
|
}
|
|
|
|
internal class OrganizationCipherCustomizeAttribute : BitCustomizeAttribute
|
|
{
|
|
public override ICustomization GetCustomization() => new OrganizationCipher();
|
|
}
|