1
0
mirror of https://github.com/bitwarden/server synced 2026-02-19 02:43:38 +00:00
Files
server/test/SeederApi.IntegrationTest/PresetLoaderTests.cs
2026-02-17 07:42:53 +01:00

36 lines
1.2 KiB
C#

using Bit.Seeder;
using Bit.Seeder.Pipeline;
using Xunit;
namespace Bit.SeederApi.IntegrationTest;
public class PresetLoaderTests
{
[Fact]
public void Load_FixtureOrgWithGeneratedCiphers_InitializesGenerator()
{
// Issue #2: Fixture-based org + generated ciphers should resolve domain from fixture
// This test verifies that when a preset uses a fixture org (no explicit domain)
// but wants to generate ciphers (needs domain for generator), the domain is
// automatically resolved by reading the org fixture.
var services = new ServiceCollection();
var builder = services.AddRecipe("fixture-org-test");
builder
.UseOrganization("dunder-mifflin") // Fixture org (domain in fixture)
.AddOwner()
.WithGenerator("dundermifflin.com") // Generator needs domain
.AddCiphers(50);
// This should NOT throw "Generated ciphers require a generator"
builder.Validate();
using var provider = services.BuildServiceProvider();
var steps = provider.GetKeyedServices<IStep>("fixture-org-test").ToList();
Assert.NotNull(steps);
Assert.NotEmpty(steps);
}
}