예제 #1
0
 def test_activation_key_expired(self, warning, get_current):
     get_current.return_value.domain = "testserver"
     user = RegistrationProfile.objects.create_inactive_user("sumouser1234", "testpass", "*****@*****.**")
     profile = RegistrationProfile.objects.get(user=user)
     user.date_joined = user.date_joined - timedelta(days=1000)
     user.save()
     RegistrationProfile.objects.activate_user(profile.activation_key)
     assert warning.called
     eq_("User activation failure (key expired): {k}".format(k=profile.activation_key), warning.call_args[0][0])
예제 #2
0
 def test_user_change_email_same(self):
     """Changing to same email shows validation error."""
     self.client.login(username='******', password='******')
     user = User.objects.get(username='******')
     user.email = '*****@*****.**'
     user.save()
     response = self.client.post(reverse('users.change_email'),
                                 {'email': user.email})
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('This is your current email.', doc('ul.errorlist').text())
예제 #3
0
 def test_user_change_email_same(self):
     """Changing to same email shows validation error."""
     self.client.login(username='******', password='******')
     user = User.objects.get(username='******')
     user.email = '*****@*****.**'
     user.save()
     response = self.client.post(reverse('users.change_email'),
                                 {'email': user.email})
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('This is your current email.', doc('ul.errorlist').text())
예제 #4
0
 def test_activation_key_expired(self, warning, get_current):
     get_current.return_value.domain = 'testserver'
     user = RegistrationProfile.objects.create_inactive_user(
         'sumouser1234', 'testpass', '*****@*****.**')
     profile = RegistrationProfile.objects.get(user=user)
     user.date_joined = user.date_joined - timedelta(days=1000)
     user.save()
     RegistrationProfile.objects.activate_user(profile.activation_key)
     assert warning.called
     eq_(
         'User activation failure (key expired): {k}'.format(
             k=profile.activation_key), warning.call_args[0][0])
예제 #5
0
파일: test_views.py 프로젝트: timmi/kitsune
 def test_active_user_activation(self, get_current):
     """If an already active user tries to activate with a valid key,
     we take them to login page and show message."""
     get_current.return_value.domain = 'su.mo.com'
     user = RegistrationProfile.objects.create_inactive_user(
         'sumouser1234', 'testpass', '*****@*****.**')
     user.is_active = True
     user.save()
     key = RegistrationProfile.objects.all()[0].activation_key
     url = reverse('users.activate', args=[user.id, key])
     response = self.client.get(url, follow=True)
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('Your account is already activated, log in below.',
         doc('ul.user-messages').text())
예제 #6
0
파일: test_views.py 프로젝트: icaaq/kitsune
 def test_active_user_activation(self, get_current):
     """If an already active user tries to activate with a valid key,
     we take them to login page and show message."""
     get_current.return_value.domain = 'su.mo.com'
     user = RegistrationProfile.objects.create_inactive_user(
         'sumouser1234', 'testpass', '*****@*****.**')
     user.is_active = True
     user.save()
     key = RegistrationProfile.objects.all()[0].activation_key
     url = reverse('users.activate', args=[user.id, key])
     response = self.client.get(url, follow=True)
     eq_(200, response.status_code)
     doc = pq(response.content)
     eq_('Your account is already activated, log in below.',
         doc('ul.user-messages').text())