From 3d7cc11820ba87ab53d992b3ddd3fc57545ee4eb Mon Sep 17 00:00:00 2001 From: Aviad Lichtenstadt Date: Fri, 13 Dec 2024 22:32:45 +0200 Subject: [PATCH] Invite template id (#465) + test related to https://github.com/descope/etc/issues/8535 --- descope/management/user.py | 5 +++++ tests/management/test_user.py | 2 ++ 2 files changed, 7 insertions(+) diff --git a/descope/management/user.py b/descope/management/user.py index 917a4ff5..6a829f94 100644 --- a/descope/management/user.py +++ b/descope/management/user.py @@ -229,6 +229,7 @@ def invite( ] = None, # send invite via text message, default is according to project settings additional_login_ids: Optional[List[str]] = None, sso_app_ids: Optional[List[str]] = None, + template_id: str = "", ) -> dict: """ Create a new user and invite them via an email / text message. @@ -267,6 +268,7 @@ def invite( send_sms, additional_login_ids, sso_app_ids, + template_id, ), pswd=self._auth.management_key, ) @@ -1652,6 +1654,7 @@ def _compose_create_body( send_sms: Optional[bool], additional_login_ids: Optional[List[str]], sso_app_ids: Optional[List[str]] = None, + template_id: str = "", ) -> dict: body = User._compose_update_body( login_id=login_id, @@ -1680,6 +1683,8 @@ def _compose_create_body( body["sendMail"] = send_mail if send_sms is not None: body["sendSMS"] = send_sms + if template_id != "": + body["templateId"] = template_id return body @staticmethod diff --git a/tests/management/test_user.py b/tests/management/test_user.py index bd9e6be9..5eb30ffc 100644 --- a/tests/management/test_user.py +++ b/tests/management/test_user.py @@ -236,6 +236,7 @@ def test_invite(self): invite_url="invite.me", send_sms=True, sso_app_ids=["app1", "app2"], + template_id="tid", ) user = resp["user"] self.assertEqual(user["id"], "u1") @@ -264,6 +265,7 @@ def test_invite(self): "sendSMS": True, "additionalLoginIds": None, "ssoAppIDs": ["app1", "app2"], + "templateId": "tid", }, allow_redirects=False, verify=True,