mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 12:41:30 +00:00
ec21c9bb29
M28: ACME Renewal Information (RFC 9702) — CA-directed renewal timing with cert ID computation, directory endpoint discovery, graceful degradation for non-ARI CAs. 19 tests. M29: Email notifier wiring + scheduled certificate digest — SMTP connector bridged to service layer via NotifierAdapter, DigestService with HTML email template, 7th scheduler loop (24h), digest preview/send API endpoints and GUI card. 21 tests. M30: Production-ready Helm chart — server Deployment, PostgreSQL StatefulSet, agent DaemonSet, ConfigMaps, Secrets, Ingress, security contexts, health probes, example values for dev/prod/ACME scenarios. Also: OpenAPI spec updates, MCP tool additions, CI helm-lint job, documentation updates across 5 doc files and README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package email
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
)
|
|
|
|
func TestNotifierAdapter_Channel(t *testing.T) {
|
|
connector := New(&Config{
|
|
SMTPHost: "smtp.example.com",
|
|
SMTPPort: 587,
|
|
FromAddress: "test@example.com",
|
|
}, nil)
|
|
adapter := NewNotifierAdapter(connector)
|
|
|
|
if adapter.Channel() != "Email" {
|
|
t.Errorf("expected channel 'Email', got '%s'", adapter.Channel())
|
|
}
|
|
}
|
|
|
|
func TestNotifierAdapter_Send_EmptyRecipient(t *testing.T) {
|
|
connector := New(&Config{
|
|
SMTPHost: "smtp.example.com",
|
|
SMTPPort: 587,
|
|
FromAddress: "test@example.com",
|
|
}, nil)
|
|
adapter := NewNotifierAdapter(connector)
|
|
|
|
err := adapter.Send(context.Background(), "", "test subject", "test body")
|
|
if err == nil {
|
|
t.Fatal("expected error for empty recipient")
|
|
}
|
|
}
|
|
|
|
func TestNotifierAdapter_SendHTML_EmptyRecipient(t *testing.T) {
|
|
connector := New(&Config{
|
|
SMTPHost: "smtp.example.com",
|
|
SMTPPort: 587,
|
|
FromAddress: "test@example.com",
|
|
}, nil)
|
|
adapter := NewNotifierAdapter(connector)
|
|
|
|
err := adapter.SendHTML(context.Background(), "", "test subject", "<html>test</html>")
|
|
if err == nil {
|
|
t.Fatal("expected error for empty recipient")
|
|
}
|
|
}
|