- Brand, DefaultBrand and CompileBrandCSS: thirteen colours, each checked as a six-digit hex colour, compiled into CSS for plain elements and the built-in layouts and partials - once the branding row exists its compiled CSS replaces mail.brandCss; mail.css still follows, and the file version sent after a failing override keeps the Branding - layouts get logoUrl, built per send from storage.uploads.public_url or app.url through attach.AbsolutePublicURL; a logo that cannot be shown is left out with a rate-limited warning - Editor previews and validates a Branding draft (rule colour) Plan 35-01, task 5.
401 lines
18 KiB
Go
401 lines
18 KiB
Go
package postcard
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"path/filepath"
|
|
"reflect"
|
|
"strings"
|
|
"testing"
|
|
|
|
"git.golem15.com/golem15/summercms/modules/compass"
|
|
"git.golem15.com/golem15/summercms/modules/lagoon/attach"
|
|
"github.com/go-gormigrate/gormigrate/v2"
|
|
)
|
|
|
|
// brandCfg writes config files and opens them: files maps a config file
|
|
// name such as mail.yaml to its content.
|
|
func brandCfg(t *testing.T, files map[string]string) *compass.Config {
|
|
t.Helper()
|
|
dir := t.TempDir()
|
|
for name, body := range files {
|
|
writeFile(t, filepath.Join(dir, name), body)
|
|
}
|
|
return loadMailCfg(t, dir, nil)
|
|
}
|
|
|
|
// styleBlock returns the content of the first style element of html.
|
|
func styleBlock(t *testing.T, html string) string {
|
|
t.Helper()
|
|
_, rest, ok := strings.Cut(html, "<style")
|
|
if !ok {
|
|
t.Fatalf("no style block in %q", html)
|
|
}
|
|
_, rest, _ = strings.Cut(rest, ">")
|
|
css, _, _ := strings.Cut(rest, "</style>")
|
|
return css
|
|
}
|
|
|
|
// TestMailBrandSmoke covers Branding: the compiled brand CSS and its colour
|
|
// checks, the precedence over mail.brandCss once the settings row exists,
|
|
// the logo URL built at send time from configuration, and the editor's
|
|
// preview of unsaved colours.
|
|
func TestMailBrandSmoke(t *testing.T) {
|
|
ctx := context.Background()
|
|
|
|
t.Run("absolute_url", func(t *testing.T) {
|
|
const key = "abc/def/123/abcdef123456.png"
|
|
cases := []struct {
|
|
name string
|
|
files map[string]string
|
|
want string
|
|
}{
|
|
{"public_url", map[string]string{"storage.yaml": "uploads:\n public_url: https://cdn.example.com/u\n", "app.yaml": "url: https://acme.test\n"}, "https://cdn.example.com/u/" + key},
|
|
{"public_url trailing slash", map[string]string{"storage.yaml": "uploads:\n public_url: https://cdn.example.com/u/\n"}, "https://cdn.example.com/u/" + key},
|
|
{"app.url and the default prefix", map[string]string{"app.yaml": "url: https://acme.test\n"}, "https://acme.test/storage/uploads/" + key},
|
|
{"app.url with a path and a prefix", map[string]string{"app.yaml": "url: https://acme.test/shop/\n", "storage.yaml": "uploads:\n public_path_prefix: /files/\n"}, "https://acme.test/shop/files/" + key},
|
|
}
|
|
for _, tc := range cases {
|
|
got, err := attach.AbsolutePublicURL(brandCfg(t, tc.files), "/"+key)
|
|
if err != nil || got != tc.want {
|
|
t.Errorf("%s: %q, %v; want %q", tc.name, got, err, tc.want)
|
|
}
|
|
}
|
|
for name, files := range map[string]map[string]string{
|
|
"neither": {"mail.yaml": "driver: memory\n"},
|
|
"relative app.url": {"app.yaml": "url: /shop\n"},
|
|
"app.url no scheme": {"app.yaml": "url: acme.test\n"},
|
|
"app.url ftp": {"app.yaml": "url: ftp://acme.test\n"},
|
|
} {
|
|
if got, err := attach.AbsolutePublicURL(brandCfg(t, files), key); !errors.Is(err, attach.ErrNoAbsoluteURL) || got != "" {
|
|
t.Errorf("%s: %q, %v; want ErrNoAbsoluteURL", name, got, err)
|
|
}
|
|
}
|
|
if _, err := attach.AbsolutePublicURL(nil, key); !errors.Is(err, attach.ErrNoAbsoluteURL) {
|
|
t.Errorf("nil config: %v", err)
|
|
}
|
|
if _, err := attach.AbsolutePublicURL(brandCfg(t, map[string]string{"storage.yaml": "uploads:\n public_url: cdn.example.com\n", "app.yaml": "url: https://acme.test\n"}), key); err == nil || errors.Is(err, attach.ErrNoAbsoluteURL) {
|
|
t.Errorf("a malformed public_url = %v, want its own error", err)
|
|
}
|
|
})
|
|
|
|
t.Run("defaults", func(t *testing.T) {
|
|
want := Brand{
|
|
BodyBg: "#f5f8fa", ContentBg: "#ffffff", HeaderColor: "#bbbfc3", FooterColor: "#aeaeae",
|
|
HeadingColor: "#2f3133", TextColor: "#74787e", LinkColor: "#2da7c7", ButtonTextColor: "#ffffff",
|
|
ButtonPrimaryBg: "#d66829", ButtonPositiveBg: "#52a838", ButtonNegativeBg: "#e01346",
|
|
PanelBg: "#edeff2", TableBorderColor: "#edeff2",
|
|
}
|
|
if got := DefaultBrand(); got != want {
|
|
t.Errorf("DefaultBrand() = %+v, want %+v", got, want)
|
|
}
|
|
})
|
|
|
|
t.Run("compile", func(t *testing.T) {
|
|
// Thirteen distinct colours, so each one can be found in the output.
|
|
b := Brand{
|
|
BodyBg: "#010101", ContentBg: "#020202", HeaderColor: "#030303", FooterColor: "#040404",
|
|
HeadingColor: "#050505", TextColor: "#060606", LinkColor: "#070707", ButtonTextColor: "#080808",
|
|
ButtonPrimaryBg: "#090909", ButtonPositiveBg: "#0a0a0a", ButtonNegativeBg: "#0b0b0b",
|
|
PanelBg: "#0c0c0c", TableBorderColor: "#0d0d0d",
|
|
}
|
|
css, err := CompileBrandCSS(b)
|
|
if err != nil {
|
|
t.Fatalf("CompileBrandCSS: %v", err)
|
|
}
|
|
v := reflect.ValueOf(b)
|
|
for i := range v.NumField() {
|
|
if colour := v.Field(i).String(); colour != "" && !strings.Contains(css, colour) {
|
|
t.Errorf("compiled CSS lacks %s (%s)", v.Type().Field(i).Name, colour)
|
|
}
|
|
}
|
|
for _, want := range []string{
|
|
"body {", "background-color: #010101", "a {\n\tcolor: #070707", "h1 {\n\tcolor: #050505",
|
|
".button-primary {\n\tbackground-color: #090909", ".button-positive {\n\tbackground-color: #0a0a0a",
|
|
".button-negative {\n\tbackground-color: #0b0b0b", ".panel-content {\n\tbackground-color: #0c0c0c",
|
|
".table th {\n\tborder-bottom: 1px solid #0d0d0d", ".subcopy {", ".footer p {\n\tcolor: #040404",
|
|
".header a, .header span {\n\tcolor: #030303", ".body {\n\tbackground-color: #020202",
|
|
} {
|
|
if !strings.Contains(css, want) {
|
|
t.Errorf("compiled CSS lacks %q", want)
|
|
}
|
|
}
|
|
if err := validateHTML("<style>" + css + "</style>"); err != nil {
|
|
t.Errorf("the compiled CSS fails the mail safety checks: %v", err)
|
|
}
|
|
if strings.Contains(css, "<") || strings.Contains(css, "{{") {
|
|
t.Errorf("compiled CSS holds markup or an unexecuted action:\n%s", css)
|
|
}
|
|
|
|
def, err := CompileBrandCSS(DefaultBrand())
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
for _, colour := range []string{"#f5f8fa", "#ffffff", "#bbbfc3", "#aeaeae", "#2f3133", "#74787e", "#2da7c7", "#d66829", "#52a838", "#e01346", "#edeff2"} {
|
|
if !strings.Contains(def, colour) {
|
|
t.Errorf("default CSS lacks %s", colour)
|
|
}
|
|
}
|
|
// An empty colour is that field's default; the zero Brand is the default brand.
|
|
if zero, err := CompileBrandCSS(Brand{}); err != nil || zero != def {
|
|
t.Errorf("CompileBrandCSS(Brand{}) differs from the default brand: %v", err)
|
|
}
|
|
// Upper-case hex is accepted and emitted lower-case.
|
|
upper, err := CompileBrandCSS(Brand{ButtonPrimaryBg: "#AB12CD"})
|
|
if err != nil || !strings.Contains(upper, "#ab12cd") || strings.Contains(upper, "#AB12CD") {
|
|
t.Errorf("upper-case hex: %v", err)
|
|
}
|
|
// The logo URL is not a colour and does not reach the CSS.
|
|
if with, err := CompileBrandCSS(Brand{LogoURL: "https://cdn.example.com/logo.png"}); err != nil || with != def {
|
|
t.Errorf("LogoURL changed the CSS: %v", err)
|
|
}
|
|
|
|
bad := map[string]string{
|
|
"short hex": "#ABC",
|
|
"name": "red",
|
|
"style end": "#fff</style><script>",
|
|
"no hash": "aabbcc",
|
|
"eight": "#aabbccdd",
|
|
"expression": "#aabbcc;} body{display:none",
|
|
"spaces": " #aabbcc",
|
|
}
|
|
for name, colour := range bad {
|
|
_, err := CompileBrandCSS(Brand{PanelBg: colour})
|
|
if err == nil || !strings.Contains(err.Error(), "panel_bg") {
|
|
t.Errorf("%s (%q): error = %v, want one naming panel_bg", name, colour, err)
|
|
}
|
|
if err != nil && strings.Contains(err.Error(), "<script>") {
|
|
t.Errorf("%s: the error repeats the value: %v", name, err)
|
|
}
|
|
}
|
|
if _, err := CompileBrandCSS(Brand{BodyBg: "x", LinkColor: "y"}); err == nil || !strings.Contains(err.Error(), "body_bg") {
|
|
t.Errorf("the first bad field is not named: %v", err)
|
|
}
|
|
})
|
|
|
|
t.Run("preview", func(t *testing.T) {
|
|
ed, drv := newEditor(t, nil)
|
|
ed.m.opts.CSS, ed.m.opts.BrandCSS = "p{margin:1px}", ".cfg{color:blue}"
|
|
draft := Draft{Kind: KindBrand, Brand: &Brand{LinkColor: "#112233", ButtonPrimaryBg: "#445566"}}
|
|
if problem := ed.Validate(ctx, draft); problem != nil {
|
|
t.Fatalf("a valid brand draft was refused: %+v", problem)
|
|
}
|
|
got, err := ed.Preview(ctx, draft)
|
|
if err != nil {
|
|
t.Fatalf("Preview: %v", err)
|
|
}
|
|
css := styleBlock(t, got.HTML)
|
|
if !strings.Contains(css, "color: #112233") || !strings.Contains(css, "background-color: #445566") {
|
|
t.Errorf("the draft colours are not in the style block:\n%s", css)
|
|
}
|
|
if strings.Contains(css, ".cfg{color:blue}") || !strings.HasSuffix(css, "p{margin:1px}") {
|
|
t.Errorf("the draft CSS must replace mail.brandCss and leave mail.css after it:\n%s", css)
|
|
}
|
|
for _, want := range []string{`<div class="content-body"><h1>`, `class="button button-primary"`, `<table class="panel`} {
|
|
if !strings.Contains(got.HTML, want) {
|
|
t.Errorf("brand preview lacks %q:\n%s", want, got.HTML)
|
|
}
|
|
}
|
|
if got.Subject == "" || got.Text == "" {
|
|
t.Errorf("brand preview = %+v", got)
|
|
}
|
|
// A draft without colours previews the defaults.
|
|
if got, err = ed.Preview(ctx, Draft{Kind: KindBrand}); err != nil || !strings.Contains(got.HTML, "#d66829") {
|
|
t.Errorf("a brand draft without colours: %v", err)
|
|
}
|
|
|
|
bad := ed.Validate(ctx, Draft{Kind: KindBrand, Brand: &Brand{ButtonPrimaryBg: "red"}})
|
|
if bad == nil || bad.Field != "button_primary_bg" || bad.Rule != "colour" {
|
|
t.Errorf("an invalid colour = %+v, want field button_primary_bg rule colour", bad)
|
|
}
|
|
var de *DraftError
|
|
if _, err := ed.Preview(ctx, Draft{Kind: KindBrand, Brand: &Brand{TableBorderColor: "#12"}}); !errors.As(err, &de) || de.Field != "table_border_color" {
|
|
t.Errorf("Preview with an invalid colour = %v", err)
|
|
}
|
|
|
|
// The logo of the draft reaches a layout that uses logoUrl, and the
|
|
// saved Branding of the source is replaced by the draft.
|
|
ed, _ = newEditor(t, &Overrides{
|
|
Brand: &Brand{LinkColor: "#999999", LogoURL: "https://cdn.example.com/saved.png"},
|
|
Layouts: map[string]LayoutOverride{defaultLayoutName: {HTML: `<img src="{{ .logoUrl }}" alt=""><style>{{ .brandCss }}</style>{{ .Content }}`, Text: "{{ .logoUrl }}\n{{ .Content }}"}},
|
|
})
|
|
got, err = ed.Preview(ctx, Draft{Kind: KindBrand, Brand: &Brand{LinkColor: "#112233", LogoURL: "https://cdn.example.com/u/logo.png"}})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.HasPrefix(got.HTML, `<img src="https://cdn.example.com/u/logo.png" alt="">`) || !strings.Contains(got.HTML, "#112233") || strings.Contains(got.HTML, "#999999") {
|
|
t.Errorf("brand preview with a logo:\n%s", got.HTML)
|
|
}
|
|
if !strings.HasPrefix(got.Text, "https://cdn.example.com/u/logo.png\n") {
|
|
t.Errorf("text = %q", got.Text)
|
|
}
|
|
// Other drafts are previewed with the saved Branding.
|
|
got, err = ed.Preview(ctx, Draft{Kind: KindTemplate, Name: editorWelcome, Subject: "x", Body: "Hi.", Layout: defaultLayoutName})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if !strings.HasPrefix(got.HTML, `<img src="https://cdn.example.com/saved.png" alt="">`) || !strings.Contains(got.HTML, "#999999") {
|
|
t.Errorf("a template preview does not use the saved Branding:\n%s", got.HTML)
|
|
}
|
|
|
|
// A test send of a brand draft goes to the one address.
|
|
ed, drv = newEditor(t, nil)
|
|
if err := ed.SendDraft(ctx, draft, "admin@example.com"); err != nil {
|
|
t.Fatalf("SendDraft: %v", err)
|
|
}
|
|
if msg := lastMessage(t, drv); len(msg.To) != 1 || msg.To[0] != "admin@example.com" || !strings.Contains(msg.HTML, "#445566") {
|
|
t.Errorf("brand draft mail = %+v", msg)
|
|
}
|
|
})
|
|
|
|
t.Run("precedence", func(t *testing.T) {
|
|
gdb := mailPostgres(t)
|
|
cfg := brandCfg(t, map[string]string{"mail.yaml": "driver: memory\ncss: \"p{margin:1px}\"\nbrandCss: \".cfg{color:blue}\"\n"})
|
|
m, drv, logs := bootMailAppCfg(t, gdb, cfg)
|
|
|
|
// No Branding row: the configured brand CSS, as before.
|
|
sendFixture(t, m, acmeNotice, "")
|
|
if css := styleBlock(t, lastMessage(t, drv).HTML); css != ".cfg{color:blue}p{margin:1px}" {
|
|
t.Errorf("without a Branding row the style block = %q, want mail.brandCss then mail.css", css)
|
|
}
|
|
|
|
// The row exists: its compiled colours replace mail.brandCss.
|
|
if err := gdb.Exec(`INSERT INTO ` + BrandTable + ` (id, link_color) VALUES (1, '#112233')`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
sendFixture(t, m, acmeNotice, "")
|
|
css := styleBlock(t, lastMessage(t, drv).HTML)
|
|
want, err := CompileBrandCSS(Brand{LinkColor: "#112233"})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if css != want+"p{margin:1px}" {
|
|
t.Errorf("with a Branding row the style block is not the compiled CSS followed by mail.css:\n%s", css)
|
|
}
|
|
if strings.Contains(css, ".cfg{color:blue}") || !strings.Contains(css, "color: #112233") || !strings.Contains(css, "#d66829") {
|
|
t.Errorf("style block = %q", css)
|
|
}
|
|
if logs.Len() != 0 {
|
|
t.Errorf("unexpected log output:\n%s", logs)
|
|
}
|
|
|
|
// A failing template override falls back to the file version, which
|
|
// still carries the Branding.
|
|
customizeTemplate(t, gdb, acmeNotice, "Hello", "{{ .order.code }}", "")
|
|
sendFixture(t, m, acmeNotice, "")
|
|
got := lastMessage(t, drv)
|
|
if got.Subject != "Notice" || styleBlock(t, got.HTML) != want+"p{margin:1px}" {
|
|
t.Errorf("the file version sent after a failing override lost the Branding: %+v", got)
|
|
}
|
|
if !strings.Contains(logs.String(), "override failed") {
|
|
t.Errorf("log = %q, want the override failure", logs)
|
|
}
|
|
|
|
// A colour that is not valid keeps mail.brandCss and says so.
|
|
logs.Reset()
|
|
if err := gdb.Exec(`UPDATE ` + TemplatesTable + ` SET is_custom = FALSE`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := gdb.Exec(`UPDATE ` + BrandTable + ` SET panel_bg = 'red' WHERE id = 1`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
sendFixture(t, m, acmeNotice, "")
|
|
if css := styleBlock(t, lastMessage(t, drv).HTML); css != ".cfg{color:blue}p{margin:1px}" {
|
|
t.Errorf("with an invalid colour the style block = %q, want the configured CSS", css)
|
|
}
|
|
if out := logs.String(); !strings.Contains(out, "level=WARN") || !strings.Contains(out, "panel_bg") {
|
|
t.Errorf("log = %q, want a warning naming panel_bg", out)
|
|
}
|
|
|
|
// The source reports the row as it is, without a template name too.
|
|
ov, err := NewDBSource(appWith(t, gdb)).MailOverrides(ctx, "")
|
|
if err != nil || ov.Brand == nil || ov.Brand.LinkColor != "#112233" || ov.Brand.PanelBg != "red" || ov.Brand.LogoURL != "" {
|
|
t.Errorf("Brand from the source = %+v, %v", ov.Brand, err)
|
|
}
|
|
})
|
|
|
|
t.Run("logo", func(t *testing.T) {
|
|
gdb := mailPostgres(t)
|
|
if err := gormigrate.New(gdb, &gormigrate.Options{TableName: "attach_migrations", IDColumnName: "id", IDColumnSize: 255}, attach.Migrations).Migrate(); err != nil {
|
|
t.Fatalf("attach migrations: %v", err)
|
|
}
|
|
stmts := []string{
|
|
`INSERT INTO system_files (id, disk_name, file_name, file_size, content_type, is_public) VALUES
|
|
(7, 'abcdef123456.png', 'logo.png', 10, 'image/png', TRUE),
|
|
(8, 'fedcba654321.png', 'private.png', 10, 'image/png', FALSE)`,
|
|
`INSERT INTO ` + BrandTable + ` (id, logo_file_id) VALUES (1, 7)`,
|
|
// A layout that shows the logo, for the welcome template.
|
|
`INSERT INTO ` + LayoutsTable + ` (code, source, name, content_html, content_text, is_custom) VALUES
|
|
('acme.blog::mail.layouts.blog', 'acme.blog', 'Blog', '{{ if .logoUrl }}<img src="{{ .logoUrl }}" alt="">{{ end }}<div>{{ .Content }}</div>', '[{{ .logoUrl }}] {{ .Content }}', TRUE)`,
|
|
}
|
|
for _, stmt := range stmts {
|
|
if err := gdb.Exec(stmt).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|
|
const key = "abc/def/123/abcdef123456.png"
|
|
send := func(files map[string]string) (RenderedMessage, string) {
|
|
t.Helper()
|
|
m, drv, logs := bootMailAppCfg(t, gdb, brandCfg(t, files))
|
|
sendWelcome(t, m, "")
|
|
return lastMessage(t, drv), logs.String()
|
|
}
|
|
|
|
// storage.uploads.public_url wins; no bucket was opened in this process.
|
|
got, logged := send(map[string]string{"storage.yaml": "uploads:\n public_url: https://cdn.example.com/u\n", "app.yaml": "url: https://acme.test\n"})
|
|
if !strings.HasPrefix(got.HTML, `<img src="https://cdn.example.com/u/`+key+`" alt=""><div>`) || !strings.HasPrefix(got.Text, "[https://cdn.example.com/u/"+key+"] ") {
|
|
t.Errorf("logo from public_url: %q / %q", got.HTML, got.Text)
|
|
}
|
|
if logged != "" {
|
|
t.Errorf("unexpected log output: %s", logged)
|
|
}
|
|
// Otherwise app.url and the public path prefix.
|
|
got, _ = send(map[string]string{"app.yaml": "url: https://acme.test\n"})
|
|
if !strings.HasPrefix(got.HTML, `<img src="https://acme.test/storage/uploads/`+key+`" alt=""><div>`) {
|
|
t.Errorf("logo from app.url: %q", got.HTML)
|
|
}
|
|
// Neither is configured: no logo, a warning, the mail is sent.
|
|
got, logged = send(map[string]string{"mail.yaml": "driver: memory\n"})
|
|
if !strings.HasPrefix(got.HTML, "<div><p>Hi <strong>Ada</strong>") || !strings.HasPrefix(got.Text, "[] ") {
|
|
t.Errorf("without a base URL: %q / %q", got.HTML, got.Text)
|
|
}
|
|
if !strings.Contains(logged, "level=WARN") || !strings.Contains(logged, "logo") {
|
|
t.Errorf("log = %q, want a warning about the logo", logged)
|
|
}
|
|
|
|
// A file that is not public, and a file that is gone.
|
|
for name, id := range map[string]int{"not public": 8, "missing": 99} {
|
|
if err := gdb.Exec(`UPDATE `+BrandTable+` SET logo_file_id = ? WHERE id = 1`, id).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
got, logged = send(map[string]string{"app.yaml": "url: https://acme.test\n"})
|
|
if !strings.HasPrefix(got.HTML, "<div><p>Hi <strong>Ada</strong>") || strings.Contains(got.HTML, "<img") {
|
|
t.Errorf("%s: %q", name, got.HTML)
|
|
}
|
|
if !strings.Contains(logged, "level=WARN") || !strings.Contains(logged, "logo") {
|
|
t.Errorf("%s: log = %q, want a warning about the logo", name, logged)
|
|
}
|
|
}
|
|
|
|
// No logo chosen: no warning.
|
|
if err := gdb.Exec(`UPDATE ` + BrandTable + ` SET logo_file_id = NULL WHERE id = 1`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got, logged = send(map[string]string{"app.yaml": "url: https://acme.test\n"}); strings.Contains(got.HTML, "<img") || logged != "" {
|
|
t.Errorf("without a logo: %q, log %q", got.HTML, logged)
|
|
}
|
|
|
|
// The files table missing altogether does not lose the other overrides.
|
|
if err := gdb.Exec(`UPDATE ` + BrandTable + ` SET logo_file_id = 7, link_color = '#112233' WHERE id = 1`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if err := gdb.Exec(`DROP TABLE system_files`).Error; err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
ov, err := NewDBSource(appWithCfg(t, gdb, brandCfg(t, map[string]string{"app.yaml": "url: https://acme.test\n"}))).MailOverrides(ctx, acmeWelcome)
|
|
if err != nil || ov.Brand == nil || ov.Brand.LinkColor != "#112233" || ov.Brand.LogoURL != "" || len(ov.Layouts) != 1 {
|
|
t.Errorf("overrides without system_files = %+v, %v", ov, err)
|
|
}
|
|
})
|
|
}
|