summaryrefslogtreecommitdiff
path: root/internal/email/email_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2024-06-06 15:43:25 +0200
committerLibravatar GitHub <noreply@github.com>2024-06-06 14:43:25 +0100
commitbcda048eab799284fc46d74706334bf9ef76dc83 (patch)
treec4595fe5e6e6fd570d59cee7095a336f2e884344 /internal/email/email_test.go
parentdrop date (#2969) (diff)
downloadgotosocial-bcda048eab799284fc46d74706334bf9ef76dc83.tar.xz
[feature] Self-serve email change for users (#2957)
* [feature] Email change * frontend stuff for changing email * docs * tests etc * differentiate more clearly between local user+account and account * populate user
Diffstat (limited to 'internal/email/email_test.go')
-rw-r--r--internal/email/email_test.go17
1 files changed, 16 insertions, 1 deletions
diff --git a/internal/email/email_test.go b/internal/email/email_test.go
index b57562cb5..aacca1b3d 100644
--- a/internal/email/email_test.go
+++ b/internal/email/email_test.go
@@ -40,12 +40,13 @@ func (suite *EmailTestSuite) SetupTest() {
suite.sender = testrig.NewEmailSender("../../web/template/", suite.sentEmails)
}
-func (suite *EmailTestSuite) TestTemplateConfirm() {
+func (suite *EmailTestSuite) TestTemplateConfirmNewSignup() {
confirmData := email.ConfirmData{
Username: "test",
InstanceURL: "https://example.org",
InstanceName: "Test Instance",
ConfirmLink: "https://example.org/confirm_email?token=ee24f71d-e615-43f9-afae-385c0799b7fa",
+ NewSignup: true,
}
suite.sender.SendConfirmEmail("user@example.org", confirmData)
@@ -53,6 +54,20 @@ func (suite *EmailTestSuite) TestTemplateConfirm() {
suite.Equal("To: user@example.org\r\nFrom: test@example.org\r\nSubject: GoToSocial Email Confirmation\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 8bit\r\nContent-Type: text/plain; charset=\"UTF-8\"\r\n\r\nHello test!\r\n\r\nYou are receiving this mail because you've requested an account on https://example.org.\r\n\r\nTo use your account, you must confirm that this is your email address.\r\n\r\nTo confirm your email, paste the following in your browser's address bar:\r\n\r\nhttps://example.org/confirm_email?token=ee24f71d-e615-43f9-afae-385c0799b7fa\r\n\r\n---\r\n\r\nIf you believe you've been sent this email in error, feel free to ignore it, or contact the administrator of https://example.org.\r\n\r\n", suite.sentEmails["user@example.org"])
}
+func (suite *EmailTestSuite) TestTemplateConfirm() {
+ confirmData := email.ConfirmData{
+ Username: "test",
+ InstanceURL: "https://example.org",
+ InstanceName: "Test Instance",
+ ConfirmLink: "https://example.org/confirm_email?token=ee24f71d-e615-43f9-afae-385c0799b7fa",
+ NewSignup: false,
+ }
+
+ suite.sender.SendConfirmEmail("user@example.org", confirmData)
+ suite.Len(suite.sentEmails, 1)
+ suite.Equal("To: user@example.org\r\nFrom: test@example.org\r\nSubject: GoToSocial Email Confirmation\r\nMIME-Version: 1.0\r\nContent-Transfer-Encoding: 8bit\r\nContent-Type: text/plain; charset=\"UTF-8\"\r\n\r\nHello test!\r\n\r\nYou are receiving this mail because you've requested an email address change on https://example.org.\r\n\r\nTo complete the change, you must confirm that this is your email address.\r\n\r\nTo confirm your email, paste the following in your browser's address bar:\r\n\r\nhttps://example.org/confirm_email?token=ee24f71d-e615-43f9-afae-385c0799b7fa\r\n\r\n---\r\n\r\nIf you believe you've been sent this email in error, feel free to ignore it, or contact the administrator of https://example.org.\r\n\r\n", suite.sentEmails["user@example.org"])
+}
+
func (suite *EmailTestSuite) TestTemplateReset() {
resetData := email.ResetData{
Username: "test",