From 67a5f8b2f0bedc4eb641135eb520aa974af577c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D0=BA=D1=82=D0=BE=D1=80=20=D0=93=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D0=BA=D0=B8=D1=85?= Date: Tue, 24 Sep 2019 15:07:00 +0300 Subject: [PATCH] Test web account --- apps/account/tests/tests_web.py | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/apps/account/tests/tests_web.py b/apps/account/tests/tests_web.py index 33ba109f..e771b31a 100644 --- a/apps/account/tests/tests_web.py +++ b/apps/account/tests/tests_web.py @@ -2,6 +2,7 @@ from rest_framework.test import APITestCase from rest_framework import status from authorization.tests.tests import get_tokens_for_user from django.urls import reverse +from account.models import User class AccountResetPassWordTests(APITestCase): @@ -21,4 +22,28 @@ class AccountResetPassWordTests(APITestCase): "username_or_email": self.data["username"] } response = self.client.post(url, data=data) - self.assertEqual(response.status_code, status.HTTP_200_OK) \ No newline at end of file + self.assertEqual(response.status_code, status.HTTP_200_OK) + + +class AccountResetPassWordTests(APITestCase): + + def setUp(self): + self.data = get_tokens_for_user() + + def test_reset_password_confirm(self): + data ={ + "password": "newpasswordnewpassword" + } + user = User.objects.get(email=self.data["email"]) + token = user.reset_password_token + uidb64 = user.get_user_uidb64 + + url = reverse('web:account:password-reset-confirm', kwargs={ + 'uidb64': uidb64, + 'token': token + }) + response = self.client.patch(url, data=data) + self.assertEqual(response.status_code, status.HTTP_200_OK) + + +