updated the rules when linking OAuth2 by email
This commit is contained in:
@@ -8,6 +8,35 @@ import (
|
||||
"github.com/pocketbase/pocketbase/tests"
|
||||
)
|
||||
|
||||
func TestSendRecordPasswordLoginAlert(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
testApp, _ := tests.NewTestApp()
|
||||
defer testApp.Cleanup()
|
||||
|
||||
// ensure that action url normalization will be applied
|
||||
testApp.Settings().Meta.AppUrl = "http://localhost:8090////"
|
||||
|
||||
user, _ := testApp.Dao().FindFirstRecordByData("users", "email", "test@example.com")
|
||||
|
||||
err := mails.SendRecordPasswordLoginAlert(testApp, user, "test1", "test2")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
if testApp.TestMailer.TotalSend != 1 {
|
||||
t.Fatalf("Expected one email to be sent, got %d", testApp.TestMailer.TotalSend)
|
||||
}
|
||||
|
||||
expectedParts := []string{"using a password", "OAuth2", "test1", "test2", "auth linked"}
|
||||
|
||||
for _, part := range expectedParts {
|
||||
if !strings.Contains(testApp.TestMailer.LastMessage.HTML, part) {
|
||||
t.Fatalf("Couldn't find %s\n in\n %s", part, testApp.TestMailer.LastMessage.HTML)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestSendRecordPasswordReset(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user