Skip to content

Add debug API endpoint for mail template rendering#830

Open
Varsius wants to merge 1 commit intomasterfrom
render-mail-template-endpoint
Open

Add debug API endpoint for mail template rendering#830
Varsius wants to merge 1 commit intomasterfrom
render-mail-template-endpoint

Conversation

@Varsius
Copy link
Contributor

@Varsius Varsius commented Feb 5, 2026

Checklist:

  • I updated the documentation to describe the semantical or interface changes I introduced.

@Varsius Varsius requested a review from a team as a code owner February 5, 2026 15:02
@Varsius Varsius force-pushed the render-mail-template-endpoint branch from 9f10ae5 to 30e7863 Compare February 5, 2026 15:06

Renders the mail template of the respective type using dummy values and
verifies that the generated content is valid HTML.
Requires the `?template_type` query parameter. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Requires the `?template_type` query parameter.
Requires the `template_type` query parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ? was added to be consistent with the existing admin endpoints documentation

case "transferred_commitments":
template = mailConfig.Templates.ConfirmedCommitments
default:
http.Error(w, "invalid template type", http.StatusBadRequest)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we list available templates here? The user needs admin anyhow, so we don't leak anything, right?

@Varsius Varsius force-pushed the render-mail-template-endpoint branch from 30e7863 to 5975026 Compare February 5, 2026 16:25
@github-actions
Copy link

github-actions bot commented Feb 5, 2026

Merging this branch changes the coverage (1 decrease, 1 increase)

Impacted Packages Coverage Δ 🤖
github.com/sapcc/limes/internal/api 78.04% (-0.03%) 👎
github.com/sapcc/limes/internal/test 92.31% (+0.23%) 👍

Coverage by file

Changed files (no unit tests)

Changed File Coverage Δ Total Covered Missed 🤖
github.com/sapcc/limes/internal/api/core.go 80.00% (+0.15%) 810 (+6) 648 (+6) 162 👍
github.com/sapcc/limes/internal/api/mail.go 75.76% (+75.76%) 198 (+198) 150 (+150) 48 (+48) 🌟
github.com/sapcc/limes/internal/test/setup.go 92.19% (+0.32%) 768 (+30) 708 (+30) 60 👍

Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code.

Changed unit test files

  • github.com/sapcc/limes/internal/api/mail_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants