Skip to content

Commit

Permalink
Update test notebook to get the latest notification
Browse files Browse the repository at this point in the history
  • Loading branch information
IonesioJunior committed Jul 31, 2024
1 parent f203c63 commit c19853e
Showing 1 changed file with 18 additions and 22 deletions.
40 changes: 18 additions & 22 deletions notebooks/api/0.8/13-forgot-user-password.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -55,12 +56,15 @@
"outputs": [],
"source": [
"datasite_client = server.login(email=\"[email protected]\", 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}\")"
]
},
{
Expand All @@ -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"
Expand All @@ -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",
Expand All @@ -128,7 +122,7 @@
},
{
"cell_type": "markdown",
"id": "11",
"id": "10",
"metadata": {},
"source": [
"### User use this token to reset password"
Expand All @@ -137,7 +131,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "12",
"id": "11",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -150,13 +144,15 @@
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"id": "12",
"metadata": {},
"outputs": [],
"source": [
"new_user_session = server.login(email=\"[email protected]\", password=\"Password123\")\n",
"new_user_session = server.login(\n",
" email=\"[email protected]\", 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}\")"
]
}
Expand Down

0 comments on commit c19853e

Please sign in to comment.