@@ 163-183 (lines=21) @@ | ||
160 | self.failIf(new_user.is_active) |
|
161 | self.failIf(new_user.has_usable_password()) |
|
162 | ||
163 | def test_expired_activation(self): |
|
164 | User = get_user_model() |
|
165 | expired_user = self.backend.register( |
|
166 | username='bob', email='[email protected]', |
|
167 | request=self.mock_request) |
|
168 | ||
169 | profile = expired_user.registration_profile |
|
170 | self.backend.accept(profile, request=self.mock_request) |
|
171 | ||
172 | expired_user.date_joined -= datetime.timedelta(days=settings.ACCOUNT_ACTIVATION_DAYS+1) |
|
173 | expired_user.save() |
|
174 | ||
175 | activated_user = self.backend.activate( |
|
176 | activation_key=profile.activation_key, |
|
177 | request=self.mock_request, |
|
178 | password='swardfish') |
|
179 | ||
180 | self.failIf(activated_user) |
|
181 | expired_user = User.objects.get(pk=expired_user.pk) |
|
182 | self.failIf(expired_user.is_active) |
|
183 | self.failIf(expired_user.has_usable_password()) |
|
184 | ||
185 | def test_allow(self): |
|
186 | old_allowed = settings.REGISTRATION_OPEN |
|
@@ 145-161 (lines=17) @@ | ||
142 | self.failIf(new_user.is_active) |
|
143 | self.failIf(new_user.has_usable_password()) |
|
144 | ||
145 | def test_rejected_activation(self): |
|
146 | User = get_user_model() |
|
147 | new_user = self.backend.register( |
|
148 | username='bob', email='[email protected]', |
|
149 | request=self.mock_request) |
|
150 | ||
151 | profile = new_user.registration_profile |
|
152 | self.backend.reject(profile, request=self.mock_request) |
|
153 | activated_user = self.backend.activate( |
|
154 | activation_key=profile.activation_key, |
|
155 | request=self.mock_request, |
|
156 | password='swardfish') |
|
157 | ||
158 | self.failIf(activated_user) |
|
159 | new_user = User.objects.get(pk=new_user.pk) |
|
160 | self.failIf(new_user.is_active) |
|
161 | self.failIf(new_user.has_usable_password()) |
|
162 | ||
163 | def test_expired_activation(self): |
|
164 | User = get_user_model() |