X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Ftests%2Fregistration.py;h=845b60b152576ab809a160f1172e5b5c315b9b32;hb=628a57c214b63b81e457a4a369cc370f4254358f;hp=08ed66acc1620f5b6760b8546bb228f9c3d869cd;hpb=4bc2c34df5e5eb3e7153286f59aa8bdaf0c23dc0;p=patchwork diff --git a/apps/patchwork/tests/registration.py b/apps/patchwork/tests/registration.py index 08ed66a..845b60b 100644 --- a/apps/patchwork/tests/registration.py +++ b/apps/patchwork/tests/registration.py @@ -155,12 +155,15 @@ class RegistrationConfirmationTest(TestCase): self.assertEqual(EmailConfirmation.objects.count(), 0) response = self.client.post('/register/', self.default_data) self.assertEquals(response.status_code, 200) + self.assertFalse(Person.objects.exists()) # confirm conf = EmailConfirmation.objects.filter()[0] response = self.client.get(_confirmation_url(conf)) self.assertEquals(response.status_code, 200) + qs = Person.objects.filter(email = self.user.email) + self.assertTrue(qs.exists()) person = Person.objects.get(email = self.user.email) self.assertEquals(person.name, @@ -188,3 +191,20 @@ class RegistrationConfirmationTest(TestCase): self.assertEquals(person.name, fullname) + def testRegistrationExistingPersonUnmodified(self): + """ Check that an unconfirmed registration can't modify an existing + Person object""" + + fullname = self.user.firstname + ' ' + self.user.lastname + person = Person(name = fullname, email = self.user.email) + person.save() + + # register + data = self.default_data.copy() + data['first_name'] = 'invalid' + data['last_name'] = 'invalid' + self.assertEquals(data['email'], person.email) + response = self.client.post('/register/', data) + self.assertEquals(response.status_code, 200) + + self.assertEquals(Person.objects.get(pk = person.pk).name, fullname)