1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 15:42:48 -05:00

Feature/bit auto data (#2219)

* Update ProviderService tests

* Use BitAutoData in CipherService tests

* Simplify UserCipher fixture

Because we use a single customizer for all ciphers, they all have the same userId.

* Clean up more cipher fixtures

* Swap Cipher Fixtures to BitCustomizeAttribute

* Clean up collection fixtures

* Clean up GroupFixtures

* Move SendService Tests to BitAutoData

* Clean up Organization Fixtures

TODO: The customize attributes should not be customizing more than one class

* Name files after the class they contain

* Clear up usage of CustomAutoDataAttribute in tests

* Clean up usages of InlineCustomAutoData

* format

* Manually merge with file-scoped-namespace changes
This commit is contained in:
Matt Gibson
2022-08-31 07:38:35 -06:00
committed by GitHub
parent 2d9d6ad812
commit a6d97118fa
28 changed files with 423 additions and 484 deletions

View File

@ -13,6 +13,7 @@ using Xunit;
namespace Bit.Core.Test.Services;
[SutProviderCustomize]
public class LocalAttachmentStorageServiceTests
{
@ -155,10 +156,14 @@ public class LocalAttachmentStorageServiceTests
}
}
[Theory]
[InlineUserCipherAutoData]
[InlineOrganizationCipherAutoData]
public async Task CleanupAsync_Succes(Cipher cipher)
[Theory, BitAutoData]
[UserCipherCustomize]
public async Task UserCipher_CleanupAsync_Success(Cipher cipher) => await CleanupAsync_Success(cipher);
[Theory, BitAutoData]
[OrganizationCipherCustomize]
public async Task OrganizationCipher_CleanupAsync_Success(Cipher cipher) => await CleanupAsync_Success(cipher);
private async Task CleanupAsync_Success(Cipher cipher)
{
using (var tempDirectory = new TempDirectory())
{
@ -176,10 +181,14 @@ public class LocalAttachmentStorageServiceTests
}
}
[Theory]
[InlineUserCipherAutoData]
[InlineOrganizationCipherAutoData]
public async Task DeleteAttachmentsForCipherAsync_Succes(Cipher cipher)
[Theory, BitAutoData]
[UserCipherCustomize]
public async Task UserCipher_DeleteAttachmentsForCipherAsync_Succes(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Succes(cipher);
[Theory, BitAutoData]
[OrganizationCipherCustomize]
public async Task OrganizationCipher_DeleteAttachmentsForCipherAsync_Succes(Cipher cipher) => await DeleteAttachmentsForCipherAsync_Succes(cipher);
private async Task DeleteAttachmentsForCipherAsync_Succes(Cipher cipher)
{
using (var tempDirectory = new TempDirectory())
{