mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Merge branch 'registration-hotfix'
This commit is contained in:
@@ -12,16 +12,11 @@ from RIGS import models
|
||||
|
||||
#Registration
|
||||
class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
|
||||
username = forms.CharField(required=True, max_length=30)
|
||||
first_name = forms.CharField(required=False, max_length=50)
|
||||
last_name = forms.CharField(required=False, max_length=50)
|
||||
initials = forms.CharField(required=True, max_length=5)
|
||||
phone = forms.CharField(required=False, max_length=13)
|
||||
captcha = ReCaptchaField()
|
||||
|
||||
class Meta:
|
||||
model = models.Profile
|
||||
fields = ('username','first_name','last_name','initials','phone')
|
||||
fields = ('username','email','first_name','last_name','initials','phone')
|
||||
|
||||
def clean_initials(self):
|
||||
"""
|
||||
|
||||
@@ -134,6 +134,15 @@ class UserRegistrationTest(LiveServerTestCase):
|
||||
udd = self.browser.find_element_by_class_name('navbar').text
|
||||
self.assertIn('Hi John', udd)
|
||||
|
||||
# Check all the data actually got saved
|
||||
profileObject = models.Profile.objects.all()[0]
|
||||
self.assertEqual(profileObject.username, 'TestUsername')
|
||||
self.assertEqual(profileObject.first_name, 'John')
|
||||
self.assertEqual(profileObject.last_name, 'Smith')
|
||||
self.assertEqual(profileObject.initials, 'JS')
|
||||
self.assertEqual(profileObject.phone, '0123456789')
|
||||
self.assertEqual(profileObject.email, 'test@example.com')
|
||||
|
||||
# All is well
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user