-
Notifications
You must be signed in to change notification settings - Fork 972
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend recovery flow by adding the FlowID
- Loading branch information
1 parent
7c0e02e
commit f7c4575
Showing
3 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,12 +6,14 @@ package code_test | |
import ( | ||
"context" | ||
"encoding/base64" | ||
"encoding/json" | ||
"fmt" | ||
"net/http" | ||
"testing" | ||
"time" | ||
|
||
"github.com/ory/kratos/courier" | ||
"github.com/ory/kratos/courier/template/email" | ||
"github.com/ory/kratos/internal/testhelpers" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -65,6 +67,16 @@ func TestSender(t *testing.T) { | |
require.NoError(t, err) | ||
require.Len(t, messages, 2) | ||
|
||
// verify correct templateData | ||
var templateData = string(messages[0].TemplateData[:]) | ||
var data = email.RecoveryCodeValidModel{} | ||
err = json.Unmarshal([]byte(templateData), &data) | ||
require.NoError(t, err) | ||
require.NotEmpty(t, data.To) | ||
require.NotEmpty(t, data.FlowID) | ||
require.NotEmpty(t, data.RecoveryCode) | ||
require.NotEmpty(t, data.Identity) | ||
|
||
assert.EqualValues(t, "[email protected]", messages[0].Recipient) | ||
assert.Contains(t, messages[0].Subject, "Recover access to your account") | ||
|
||
|