using HrynCo.NotificationService.DAL.Abstract.Providers; using HrynCo.NotificationService.DAL.Abstract.Repositories; using HrynCo.NotificationService.DAL.EF; using Microsoft.Extensions.DependencyInjection; namespace HrynCo.NotificationService.Web.IntegrationTests; public sealed class AdminSmtpEditorViewTests(TemplateDatabaseFixture fixture) : IClassFixture { [Fact] public async Task ExistingChannelTestIncludesIdWithoutRenderingSavedPassword() { await using var context = await DefinitionApiTestContext.CreateAsync(fixture); using var scope = context.App.Services.CreateScope(); var channel = new EmailChannel { ServiceId = context.ServiceId, EmailChannelType = EmailChannelType.Smtp, Settings = new SmtpChannelSettings { Host = "smtp.example.invalid", Username = "test-user", Password = "saved-secret-must-not-render", FromEmail = "sender@example.invalid" } }; await scope.ServiceProvider.GetRequiredService().AddAsync(channel); await scope.ServiceProvider.GetRequiredService().SaveChangesAsync(); var html = await context.Client.GetStringAsync($"/admin/channels/{channel.Id}"); Assert.Contains($"value=\"{channel.Id}\"", html); Assert.Contains("const channelId = form.querySelector('[name=\"Id\"]').value", html); Assert.DoesNotContain("saved-secret-must-not-render", html); } }