mirror of
https://github.com/bitwarden/server.git
synced 2024-11-21 12:05:42 +01:00
10782d55f3
* PM-2682 Fix v0 attachments migration on share cipher with org * PM-2682 Fix format * PM-2682 Fix tests recursion * Update src/Core/Vault/Models/Data/CipherAttachment.cs Co-authored-by: Matt Gibson <mgibson@bitwarden.com> --------- Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
37 lines
1.4 KiB
C#
37 lines
1.4 KiB
C#
using AutoFixture;
|
|
using AutoFixture.Dsl;
|
|
using Bit.Core.Vault.Models.Data;
|
|
|
|
namespace Bit.Core.Test.AutoFixture.CipherAttachmentMetaData;
|
|
|
|
public class MetaData : ICustomization
|
|
{
|
|
protected virtual IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
|
|
ICustomizationComposer<CipherAttachment.MetaData> composer)
|
|
{
|
|
return composer.With(d => d.Size, fixture.Create<long>());
|
|
}
|
|
public void Customize(IFixture fixture)
|
|
{
|
|
fixture.Customize<CipherAttachment.MetaData>(composer => ComposerAction(fixture, composer));
|
|
fixture.Behaviors.OfType<ThrowingRecursionBehavior>()
|
|
.ToList()
|
|
.ForEach(b => fixture.Behaviors.Remove(b));
|
|
fixture.Behaviors.Add(new OmitOnRecursionBehavior(1));
|
|
}
|
|
}
|
|
|
|
public class MetaDataWithoutContainer : MetaData
|
|
{
|
|
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
|
|
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
|
|
base.ComposerAction(fixture, composer).With(d => d.ContainerName, (string)null);
|
|
}
|
|
|
|
public class MetaDataWithoutKey : MetaDataWithoutContainer
|
|
{
|
|
protected override IPostprocessComposer<CipherAttachment.MetaData> ComposerAction(IFixture fixture,
|
|
ICustomizationComposer<CipherAttachment.MetaData> composer) =>
|
|
base.ComposerAction(fixture, composer).Without(d => d.Key);
|
|
}
|