From c19853e9cb3af1e5836d75ce063d31b8ee89f90e Mon Sep 17 00:00:00 2001 From: IonesioJunior Date: Wed, 31 Jul 2024 17:31:05 -0300 Subject: [PATCH] Update test notebook to get the latest notification --- .../api/0.8/13-forgot-user-password.ipynb | 40 +++++++++---------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/notebooks/api/0.8/13-forgot-user-password.ipynb b/notebooks/api/0.8/13-forgot-user-password.ipynb index 4d7f6a96426..8ad3cdf0918 100644 --- a/notebooks/api/0.8/13-forgot-user-password.ipynb +++ b/notebooks/api/0.8/13-forgot-user-password.ipynb @@ -27,6 +27,7 @@ "\n", "# syft absolute\n", "import syft as sy\n", + "from syft import SyftError\n", "from syft import SyftSuccess\n", "\n", "server = sy.orchestra.launch(\n", @@ -55,12 +56,15 @@ "outputs": [], "source": [ "datasite_client = server.login(email=\"info@openmined.org\", password=\"changethis\")\n", - "datasite_client.register(\n", - " email=\"user@openmined.org\",\n", + "res = datasite_client.register(\n", + " email=\"new_syft_user@openmined.org\",\n", " password=\"verysecurepassword\",\n", " password_verify=\"verysecurepassword\",\n", " name=\"New User\",\n", - ")" + ")\n", + "\n", + "if not isinstance(res, SyftSuccess):\n", + " raise Exception(f\"Res isn't SyftSuccess, its {res}\")" ] }, { @@ -87,25 +91,15 @@ "outputs": [], "source": [ "guest_client = server.login_as_guest()\n", - "res = guest_client.users.forgot_password(email=\"user@openmined.org\")\n", + "res = guest_client.users.forgot_password(email=\"new_syft_user@openmined.org\")\n", "\n", "if not isinstance(res, SyftSuccess):\n", " raise Exception(f\"Res isn't SyftSuccess, its {res}\")" ] }, - { - "cell_type": "code", - "execution_count": null, - "id": "8", - "metadata": {}, - "outputs": [], - "source": [ - "res" - ] - }, { "cell_type": "markdown", - "id": "9", + "id": "8", "metadata": {}, "source": [ "### Admin generates a temp token" @@ -114,12 +108,12 @@ { "cell_type": "code", "execution_count": null, - "id": "10", + "id": "9", "metadata": {}, "outputs": [], "source": [ "temp_token = datasite_client.users.request_password_reset(\n", - " datasite_client.notifications[0].linked_obj.resolve.id\n", + " datasite_client.notifications[-1].linked_obj.resolve.id\n", ")\n", "\n", "if not isinstance(temp_token, str):\n", @@ -128,7 +122,7 @@ }, { "cell_type": "markdown", - "id": "11", + "id": "10", "metadata": {}, "source": [ "### User use this token to reset password" @@ -137,7 +131,7 @@ { "cell_type": "code", "execution_count": null, - "id": "12", + "id": "11", "metadata": {}, "outputs": [], "source": [ @@ -150,13 +144,15 @@ { "cell_type": "code", "execution_count": null, - "id": "13", + "id": "12", "metadata": {}, "outputs": [], "source": [ - "new_user_session = server.login(email=\"user@openmined.org\", password=\"Password123\")\n", + "new_user_session = server.login(\n", + " email=\"new_syft_user@openmined.org\", password=\"Password123\"\n", + ")\n", "\n", - "if not isinstance(new_user_session, SyftSuccess):\n", + "if isinstance(new_user_session, SyftError):\n", " raise Exception(f\"Res isn't SyftSuccess, its {new_user_session}\")" ] }