feat(cabana): mail preview and test send to yourself
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -32,6 +32,7 @@ import (
|
||||
"git.golem15.com/golem15/summercms/modules/pact"
|
||||
"git.golem15.com/golem15/summercms/modules/party"
|
||||
"git.golem15.com/golem15/summercms/modules/phrasebook"
|
||||
"git.golem15.com/golem15/summercms/modules/postcard"
|
||||
"git.golem15.com/golem15/summercms/modules/signpost"
|
||||
"git.golem15.com/golem15/summercms/modules/surf"
|
||||
"gocloud.dev/blob"
|
||||
@@ -470,6 +471,26 @@ func conformCases() []conformCase {
|
||||
}
|
||||
return e.send(t, http.MethodGet, fmt.Sprintf("/mail/images/%d", e.mailImageID), nil, true)
|
||||
}, into[cabana.Envelope[cabana.AdminMailImage]](), nil},
|
||||
{"POST /mail/preview", 200, "cabana.Envelope-cabana_AdminMailPreviewResult", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
|
||||
return e.send(t, http.MethodPost, "/mail/preview", map[string]any{
|
||||
"mode": "branding",
|
||||
"id": 0,
|
||||
"values": map[string]any{
|
||||
"button_primary_bg": "#112233",
|
||||
},
|
||||
}, true)
|
||||
}, into[cabana.Envelope[cabana.AdminMailPreviewResult]](), nil},
|
||||
{"POST /mail/test-send", 200, "cabana.Envelope-cabana_AdminMailTestSendResult", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
|
||||
return e.send(t, http.MethodPost, "/mail/test-send", map[string]any{
|
||||
"mode": "layout",
|
||||
"id": 0,
|
||||
"values": map[string]any{
|
||||
"content_html": "{{ .Content }}",
|
||||
"content_text": "{{ .Content }}",
|
||||
"content_css": "",
|
||||
},
|
||||
}, true)
|
||||
}, into[cabana.Envelope[cabana.AdminMailTestSendResult]](), nil},
|
||||
{"GET /{vendor}/{plugin}/{controller}/schema/list", 200, "cabana.Envelope-cabana_ListSchema", func(t *testing.T, e *conformEnv) *httptest.ResponseRecorder {
|
||||
rec := e.send(t, http.MethodGet, "/acme/conform/gadgets/schema/list", nil, true)
|
||||
var body cabana.Envelope[cabana.ListSchema]
|
||||
@@ -1087,7 +1108,7 @@ func newConformEnv(t *testing.T) *conformEnv {
|
||||
// plugins.registry_url "" keeps GET /plugins from calling a registry.
|
||||
for key, value := range map[string]any{
|
||||
"http.body_limits.default_bytes": 1048576,
|
||||
"http.body_limits.upload_bytes": 1048576,
|
||||
"http.body_limits.upload_bytes": 8388608,
|
||||
"plugins.registry_url": "",
|
||||
"app.url": "https://conform.example.test",
|
||||
} {
|
||||
@@ -1107,6 +1128,12 @@ func newConformEnv(t *testing.T) *conformEnv {
|
||||
if err := attach.Publish(app, bucket); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
mailer := postcard.NewMailer(nil, postcard.NewMemoryDriver(), postcard.Options{
|
||||
From: "noreply@example.test", Overrides: postcard.NewDBSource(app),
|
||||
})
|
||||
if err := app.Publish[postcard.Mailer](mailer); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
// The acme.companions fixture serves the Phase 17 routes (dependent
|
||||
// options) next to the gadgets.
|
||||
plugins := []party.Plugin{conformPlugin{stamp: stamp}, companionsPlugin{app: app}}
|
||||
|
||||
Reference in New Issue
Block a user