# along with Patchwork; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-import unittest
from django.test import TestCase
-from django.test.client import Client
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):
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')