-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for overriding messaging template in magic link, enchante…
…d link, and OTP messages (#462)
- Loading branch information
1 parent
cbeda2e
commit 8dee0de
Showing
7 changed files
with
50 additions
and
17 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
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 |
---|---|---|
|
@@ -165,6 +165,7 @@ def test_sign_in(self): | |
LoginOptions( | ||
stepup=True, | ||
template_options={"blue": "bla"}, | ||
template_id="foo", | ||
revoke_other_sessions=True, | ||
), | ||
refresh_token=refresh_token, | ||
|
@@ -183,6 +184,7 @@ def test_sign_in(self): | |
"stepup": True, | ||
"customClaims": None, | ||
"templateOptions": {"blue": "bla"}, | ||
"templateId": "foo", | ||
"revokeOtherSessions": True, | ||
"mfa": False, | ||
}, | ||
|
@@ -304,7 +306,9 @@ def test_sign_up(self): | |
"http://test.me", | ||
None, | ||
SignUpOptions( | ||
template_options={"bla": "blue"}, revoke_other_sessions=True | ||
template_options={"bla": "blue"}, | ||
template_id="foo", | ||
revoke_other_sessions=True, | ||
), | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -321,6 +325,7 @@ def test_sign_up(self): | |
"email": "[email protected]", | ||
"loginOptions": { | ||
"templateOptions": {"bla": "blue"}, | ||
"templateId": "foo", | ||
"revokeOtherSessions": True, | ||
}, | ||
}, | ||
|
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 |
---|---|---|
|
@@ -60,7 +60,7 @@ def test_compose_body(self): | |
}, | ||
) | ||
|
||
lo = LoginOptions(stepup=True, custom_claims={"k1": "v1"}) | ||
lo = LoginOptions(stepup=True, custom_claims={"k1": "v1"}, template_id="foo") | ||
self.assertEqual( | ||
MagicLink._compose_signin_body("id1", "uri1", lo), | ||
{ | ||
|
@@ -70,6 +70,7 @@ def test_compose_body(self): | |
"stepup": True, | ||
"mfa": False, | ||
"customClaims": {"k1": "v1"}, | ||
"templateId": "foo", | ||
}, | ||
}, | ||
) | ||
|
@@ -193,7 +194,9 @@ def test_sign_in(self): | |
DeliveryMethod.EMAIL, | ||
"[email protected]", | ||
"http://test.me", | ||
LoginOptions(stepup=True, template_options={"blue": "bla"}), | ||
LoginOptions( | ||
stepup=True, template_options={"blue": "bla"}, template_id=None | ||
), | ||
refresh_token=refresh_token, | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -274,7 +277,7 @@ def test_sign_up(self): | |
"[email protected]", | ||
"http://test.me", | ||
signup_user_details, | ||
SignUpOptions(template_options={"bla": "blue"}), | ||
SignUpOptions(template_options={"bla": "blue"}, template_id="foo"), | ||
) | ||
self.assertEqual("t***@example.com", resp) | ||
|
||
|
@@ -294,7 +297,10 @@ def test_sign_up(self): | |
"email": "[email protected]", | ||
}, | ||
"email": "[email protected]", | ||
"loginOptions": {"templateOptions": {"bla": "blue"}}, | ||
"loginOptions": { | ||
"templateOptions": {"bla": "blue"}, | ||
"templateId": "foo", | ||
}, | ||
}, | ||
allow_redirects=False, | ||
verify=True, | ||
|
@@ -420,7 +426,7 @@ def test_sign_up_or_in(self): | |
DeliveryMethod.EMAIL, | ||
"[email protected]", | ||
"http://test.me", | ||
SignUpOptions(template_options={"bla": "blue"}), | ||
SignUpOptions(template_options={"bla": "blue"}, template_id="foo"), | ||
), | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -437,6 +443,7 @@ def test_sign_up_or_in(self): | |
"customClaims": None, | ||
"mfa": False, | ||
"templateOptions": {"bla": "blue"}, | ||
"templateId": "foo", | ||
}, | ||
}, | ||
allow_redirects=False, | ||
|
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 |
---|---|---|
|
@@ -258,7 +258,7 @@ def test_sign_up(self): | |
DeliveryMethod.EMAIL, | ||
"[email protected]", | ||
signup_user_details, | ||
SignUpOptions(template_options={"bla": "blue"}), | ||
SignUpOptions(template_options={"bla": "blue"}, template_id="foo"), | ||
), | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -277,7 +277,10 @@ def test_sign_up(self): | |
"email": "[email protected]", | ||
}, | ||
"email": "[email protected]", | ||
"loginOptions": {"templateOptions": {"bla": "blue"}}, | ||
"loginOptions": { | ||
"templateOptions": {"bla": "blue"}, | ||
"templateId": "foo", | ||
}, | ||
}, | ||
allow_redirects=False, | ||
verify=True, | ||
|
@@ -386,7 +389,9 @@ def test_sign_in(self): | |
client.otp.sign_in( | ||
DeliveryMethod.EMAIL, | ||
"[email protected]", | ||
LoginOptions(stepup=True, template_options={"blue": "bla"}), | ||
LoginOptions( | ||
stepup=True, template_options={"blue": "bla"}, template_id="foo" | ||
), | ||
refresh_token=refresh_token, | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -402,6 +407,7 @@ def test_sign_in(self): | |
"stepup": True, | ||
"customClaims": None, | ||
"templateOptions": {"blue": "bla"}, | ||
"templateId": "foo", | ||
"mfa": False, | ||
}, | ||
}, | ||
|
@@ -449,7 +455,7 @@ def test_sign_up_or_in(self): | |
client.otp.sign_up_or_in( | ||
DeliveryMethod.EMAIL, | ||
"[email protected]", | ||
SignUpOptions(template_options={"bla": "blue"}), | ||
SignUpOptions(template_options={"bla": "blue"}, template_id="foo"), | ||
), | ||
) | ||
mock_post.assert_called_with( | ||
|
@@ -465,6 +471,7 @@ def test_sign_up_or_in(self): | |
"customClaims": None, | ||
"mfa": False, | ||
"templateOptions": {"bla": "blue"}, | ||
"templateId": "foo", | ||
}, | ||
}, | ||
allow_redirects=False, | ||
|