-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding IncludeEmailInRedirect
field for email templates
#90
Conversation
…rove assertions around email templates
Subject: auth0.String("Verify your email"), | ||
Syntax: auth0.String("liquid"), | ||
Enabled: auth0.Bool(true), | ||
IncludeEmailInRedirect: auth0.Bool(true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only change is here.
management/email_template_test.go
Outdated
err := m.Email.Delete() | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Deleting the email provider is necessary for repeatability. Otherwise, this will fail with a 409 when attempting to instantiate an email provider in givenAnEmailProvider(t)
when one already exists.
I chose to run in this test only to limit the blast radius of the change, but it may also reside in the givenAnEmailProvider
helper function to help ensure the repeatability of other tests too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := m.Email.Delete() | |
assert.NoError(t, err) |
The email provider already gets deleted after the test: line 78 calls "givenAnEmailProvider
" which calls the delete after the test:
go-auth0/management/email_test.go
Lines 109 to 111 in bcd755a
t.Cleanup(func() { | |
cleanupEmailProvider(t) | |
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works before the test, but if an email provider already exists, it also needs to occur before a test is run. Otherwise it will perpetually fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
t.Cleanup()
registers a function to be called when the test finishes, which means the email provider will get deleted after the tests either passes or fails. So when we restart the test, there won't be any email provider to delete, as it was already deleted. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I think I get your point now. Let's do it differently tho, let's modify the givenAnEmailProvider()
func to not error if there's already an email provider, but use that instead. Wdyt?
assert.Equal(t, actualTemplate.GetBody(), template.GetBody()) | ||
assert.Equal(t, actualTemplate.GetSubject(), template.GetSubject()) | ||
assert.Equal(t, actualTemplate.GetFrom(), template.GetFrom()) | ||
assert.Equal(t, actualTemplate.GetTemplate(), template.GetTemplate()) | ||
assert.Equal(t, actualTemplate.GetIncludeEmailInRedirect(), template.GetIncludeEmailInRedirect()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding actual assertions that the replaced template is as expected.
management/email_template_test.go
Outdated
err := m.Email.Delete() | ||
assert.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err := m.Email.Delete() | |
assert.NoError(t, err) |
The email provider already gets deleted after the test: line 78 calls "givenAnEmailProvider
" which calls the delete after the test:
go-auth0/management/email_test.go
Lines 109 to 111 in bcd755a
t.Cleanup(func() { | |
cleanupEmailProvider(t) | |
}) |
Description
This PR adds the
includeEmailInRedirect
boolean field for email templates. This comes per a request in the Terraform provider.Additionally, included are some minor testing changes to the email templates testing to improve assertions and repeatability. These testing changes are only somewhat related to the core change here, but somewhat messy to separate while ensuring testing on this feature; willing to separate if requested.
References
Testing
Checklist
main
.