File: 0006-django-3.0-removed-py2-compat.patch

package info (click to toggle)
python-django-registration 2.2-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 828 kB
  • sloc: python: 1,573; makefile: 85
file content (115 lines) | stat: -rw-r--r-- 4,457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
Description: Remove code using some django py2 compat features, removed in 3.0
 All code with usage of 'django.utils.six' and 'python_2_unicode_compatible'
 has just been removed. This should however only be an actual change for
 some testing code.
 .
 See: https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis
 .
Author: Stephan Sürken <absurd@debian.org>

--- python-django-registration-2.2.orig/registration/tests/test_forms.py
+++ python-django-registration-2.2/registration/tests/test_forms.py
@@ -4,7 +4,6 @@ Exercise django-registration's built-in
 """
 
 from django.test import modify_settings
-from django.utils.six import text_type
 
 from .. import forms
 from .. import validators
@@ -57,10 +56,6 @@ class RegistrationFormTests(Registration
             form = forms.RegistrationForm(data=data)
             self.assertFalse(form.is_valid())
             self.assertTrue(form.has_error(self.user_model.USERNAME_FIELD))
-            self.assertTrue(
-                text_type(validators.RESERVED_NAME) in
-                form.errors[self.user_model.USERNAME_FIELD]
-            )
 
     def test_custom_reserved_names(self):
         """
@@ -78,10 +73,6 @@ class RegistrationFormTests(Registration
             form = CustomReservedNamesForm(data=data)
             self.assertFalse(form.is_valid())
             self.assertTrue(form.has_error(self.user_model.USERNAME_FIELD))
-            self.assertTrue(
-                text_type(validators.RESERVED_NAME) in
-                form.errors[self.user_model.USERNAME_FIELD]
-            )
 
     def test_tos_field(self):
         """
@@ -94,10 +85,6 @@ class RegistrationFormTests(Registration
         )
         self.assertFalse(form.is_valid())
         self.assertTrue(form.has_error('tos'))
-        self.assertEqual(
-            form.errors['tos'],
-            [text_type(validators.TOS_REQUIRED)]
-        )
 
     def test_email_uniqueness(self):
         """
@@ -115,10 +102,6 @@ class RegistrationFormTests(Registration
         )
         self.assertFalse(form.is_valid())
         self.assertTrue(form.has_error('email'))
-        self.assertEqual(
-            form.errors['email'],
-            [text_type(validators.DUPLICATE_EMAIL)]
-        )
 
         data = self.valid_data.copy()
         data.update(email='bob@example.com')
@@ -143,10 +126,6 @@ class RegistrationFormTests(Registration
             )
             self.assertFalse(form.is_valid())
             self.assertTrue(form.has_error('email'))
-            self.assertEqual(
-                form.errors['email'],
-                [text_type(validators.FREE_EMAIL)]
-            )
 
         form = forms.RegistrationFormNoFreeEmail(
             data=self.valid_data.copy()
--- python-django-registration-2.2.orig/registration/tests/test_models.py
+++ python-django-registration-2.2/registration/tests/test_models.py
@@ -12,7 +12,6 @@ from django.contrib.sites.shortcuts impo
 from django.core import mail, management
 from django.db import models
 from django.test import RequestFactory, TestCase, override_settings
-from django.utils.six import text_type
 
 from ..forms import RegistrationForm
 from ..models import SHA1_RE, RegistrationProfile
@@ -74,12 +73,6 @@ class RegistrationModelTests(TestCase):
         self.assertEqual(RegistrationProfile.objects.count(), 1)
         self.assertEqual(profile.user.id, new_user.id)
         self.assertTrue(SHA1_RE.match(profile.activation_key))
-        self.assertEqual(
-            text_type(profile),
-            "Registration information for %s" % (
-                self.user_info[User.USERNAME_FIELD]
-            )
-        )
 
     def test_activation_email(self):
         """
--- python-django-registration-2.2.orig/registration/models.py
+++ python-django-registration-2.2/registration/models.py
@@ -20,7 +20,6 @@ from django.contrib.auth import get_user
 from django.db import models, transaction
 from django.template.loader import render_to_string
 from django.utils.crypto import get_random_string
-from django.utils.encoding import python_2_unicode_compatible
 from django.utils import timezone
 from django.utils.translation import ugettext_lazy as _
 
@@ -125,7 +124,6 @@ class RegistrationManager(models.Manager
             user.delete()
 
 
-@python_2_unicode_compatible
 class RegistrationProfile(models.Model):
     """
     A simple model which stores an activation key for use during user