summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Finucane <stephen.finucane@intel.com>2015-08-21 15:32:13 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2015-09-17 17:50:57 +0100
commit933a8af5e7d6df1d6bd17bedf17689b0c09640aa (patch)
treebaf5c2e1082606e35d26561b4405c1122dbe489a
parent753fdc30f97f8a6557de69ee06adcf231eeafd44 (diff)
downloadpatchwork-933a8af5e7d6df1d6bd17bedf17689b0c09640aa.tar
patchwork-933a8af5e7d6df1d6bd17bedf17689b0c09640aa.tar.gz
tests/test_user: Add "profile POST" tests
POSTing to the 'profile' view will allow configuration of some user profiles, but this was not being tested. Resolve this. Acked-by: Damien Lespiau <damien.lespiau@intel.com> Signed-off-by: Stephen Finucane <stephen.finucane@intel.com> Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
-rw-r--r--patchwork/tests/test_user.py23
1 files changed, 22 insertions, 1 deletions
diff --git a/patchwork/tests/test_user.py b/patchwork/tests/test_user.py
index 61a8443..9eeda7f 100644
--- a/patchwork/tests/test_user.py
+++ b/patchwork/tests/test_user.py
@@ -24,7 +24,7 @@ from django.core import mail
from django.core.urlresolvers import reverse
from django.conf import settings
from django.contrib.auth.models import User
-from patchwork.models import EmailConfirmation, Person, Bundle
+from patchwork.models import EmailConfirmation, Person, Bundle, UserProfile
from patchwork.tests.utils import defaults, error_strings
def _confirmation_url(conf):
@@ -157,6 +157,27 @@ class UserProfileTest(TestCase):
self.assertContains(response, 'You have the following bundle')
self.assertContains(response, bundle.get_absolute_url())
+ def testUserProfileValidPost(self):
+ user_profile = UserProfile.objects.get(user=self.user.user.id)
+ old_ppp = user_profile.patches_per_page
+ new_ppp = old_ppp + 1
+
+ response = self.client.post('/user/', {'patches_per_page': new_ppp})
+
+ user_profile = UserProfile.objects.get(user=self.user.user.id)
+ self.assertEquals(user_profile.patches_per_page, new_ppp)
+
+ def testUserProfileInvalidPost(self):
+ user_profile = UserProfile.objects.get(user=self.user.user.id)
+ old_ppp = user_profile.patches_per_page
+ new_ppp = -1
+
+ response = self.client.post('/user/', {'patches_per_page': new_ppp})
+
+ user_profile = UserProfile.objects.get(user=self.user.user.id)
+ self.assertEquals(user_profile.patches_per_page, old_ppp)
+
+
class UserPasswordChangeTest(TestCase):
form_url = reverse('django.contrib.auth.views.password_change')
done_url = reverse('django.contrib.auth.views.password_change_done')