user activation now redirects to home
This commit is contained in:
@@ -9,6 +9,7 @@ from django.test import TestCase
|
||||
from django.core import mail
|
||||
from django.utils.http import urlsafe_base64_encode
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.conf import settings
|
||||
|
||||
from rest_framework.test import APITestCase
|
||||
from rest_framework import status
|
||||
@@ -492,6 +493,21 @@ class ActivateUserTest(APITestCase):
|
||||
|
||||
response = self.client.get(url)
|
||||
|
||||
# assertions
|
||||
self.assertEquals(response.status_code, 302)
|
||||
self.assertEquals(response.url, settings.ACTIVATION_REDIRECT)
|
||||
|
||||
def test_correct_activation_no_redirect(self):
|
||||
# set ACTIVATION_REDIRECT to ''
|
||||
settings.ACTIVATION_REDIRECT = ''
|
||||
# create values
|
||||
uid = urlsafe_base64_encode(force_bytes(self.user.pk))
|
||||
token = account_activation_token.make_token(self.user)
|
||||
|
||||
url = f'/activate/{uid}/{token}/'
|
||||
|
||||
response = self.client.get(url)
|
||||
|
||||
# assertions
|
||||
self.assertEquals(response.status_code, 200)
|
||||
self.assertTrue(self.user.email in str(response.content))
|
||||
|
||||
Reference in New Issue
Block a user