def setUp(self):
		user=User.objects.create_user(username='******',email='*****@*****.**',password='******')
		'''
		create a valid password reset token
		based on how django creates the token internally
		https://github.com/django/django/blob/1.11.5/django/contrib/auth/forms.py#L280
		'''
		self.uid=urlsafe_base64_encode(force_bytes(user.pk)).decode()
		self.token=default_token_generator.make_token(user)

		url=reverse('password_reset_confirm',kwargs={'uidb64':self.uid,'token':self.token})
		self.response=self.client.get(url,follow=True)
Пример #2
0
 def get_absolute_url(self):
     return reverse('post_list')
Пример #3
0
 def get_absolute_url(self):
     return reverse("post_detail", kwargs={'pk': self.pk})
	def setUp(self):
		url=reverse('password_reset_done')
		self.response=self.client.get(url)
	def test_redirection(self):
		'''
		A valid form submission should redirect the user to 'password_reset_done' view
		'''
		url=reverse('password_reset_done')
		self.assertRedirects(self.response,url)
	def setUp(self):
		email='*****@*****.**'
		User.objects.create_user(username='******',email=email,password='******')
		url=reverse('password_reset')
		swlf.response=self.client.post(url,{'email':email})
class  PasswordResetCompleteTests(TestCase):
	def setUp(self):
		url=reverse('password_reset_complete')
	def test_html(self):
		password_reset_url=reverse('password_reset')