[damned-lies] Moved account activation test to people tests
- From: Claude Paroz <claudep src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [damned-lies] Moved account activation test to people tests
- Date: Mon, 2 Apr 2018 09:40:29 +0000 (UTC)
commit 7d8af10126b28ac36e88748b5f93694f171a54f8
Author: Claude Paroz <claude 2xlibre net>
Date: Mon Apr 2 10:19:28 2018 +0200
Moved account activation test to people tests
common/tests.py | 20 --------------------
people/tests.py | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 20 deletions(-)
---
diff --git a/common/tests.py b/common/tests.py
index 95cbe38..d72d11a 100644
--- a/common/tests.py
+++ b/common/tests.py
@@ -42,26 +42,6 @@ class CommonTest(TestCase):
self.r2 = Role(team=self.t2, person=self.pt)
self.r2.save()
-
- def test_activate_account(self):
- # Testing if is_active is False by default
- response = self.client.post(reverse('register'),
- {'username': 'newuser', 'email': 'newuser example org',
- 'password1': 'blah012', 'password2': 'blah012'})
-
- self.newu = Person.objects.get(username='newuser')
- self.assertFalse(self.newu.is_active)
-
- # Testing with a invalid activation key
- response = self.client.get('/register/activate/a_invalid_key')
- self.assertContains(response, 'Sorry, the key you provided is not valid.')
-
- response = self.client.get('/register/activate/%s' % self.newu.activation_key)
- self.assertContains(response, 'Your account has been activated.')
-
- self.newu = Person.objects.get(username='newuser')
- self.assertTrue(self.newu.is_active)
-
def test_house_keeping(self):
response = self.client.get('/register/activate/a_activation_key')
self.assertContains(response, 'Your account has been activated.')
diff --git a/people/tests.py b/people/tests.py
index 35ab57e..27c30c2 100644
--- a/people/tests.py
+++ b/people/tests.py
@@ -36,6 +36,25 @@ class PeopleTestCase(TestCase):
self.assertEqual(len(mail.outbox), 1);
self.assertIn(_('Account activation'), mail.outbox[0].subject)
+ def test_activate_account(self):
+ # Testing if is_active is False by default
+ response = self.client.post(reverse('register'),
+ {'username': 'newuser', 'email': 'newuser example org',
+ 'password1': 'blah012', 'password2': 'blah012'})
+
+ self.newu = Person.objects.get(username='newuser')
+ self.assertFalse(self.newu.is_active)
+
+ # Testing with a invalid activation key
+ response = self.client.get('/register/activate/a_invalid_key')
+ self.assertContains(response, 'Sorry, the key you provided is not valid.')
+
+ response = self.client.get('/register/activate/%s' % self.newu.activation_key)
+ self.assertContains(response, 'Your account has been activated.')
+
+ self.newu = Person.objects.get(username='newuser')
+ self.assertTrue(self.newu.is_active)
+
def test_person_list(self):
self.pn = self._create_person()
response = self.client.get(reverse('people'))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]