def test_registerWithPseudonymAsRegisteredRealName(self): data = self.form_data.copy() with open('fixtures/image1.jpg', 'rb') as img: data['file'] = SimpleUploadedFile(img.name, img.read()) data['username'] = '******' form = RegistrationForm(data=data) self.assertFalse(form.is_valid())
def test_registerAlreadyTakenNickname(self): data = self.form_data.copy() with open('fixtures/image1.jpg', 'rb') as img: data['file'] = SimpleUploadedFile(img.name, img.read()) data['username'] = '******' form = RegistrationForm(data=data) self.assertFalse(form.is_valid())
def test_registerWithEmptyUsername(self): data = self.form_data.copy() data['username'] = None form = RegistrationForm(data=data) self.assertTrue(form.is_valid())
def test_notMatchingPasswords(self): data = self.form_data.copy() data['password1'] = 'test1' form = RegistrationForm(data=data) self.assertFalse(form.is_valid())
def test_invalidMailAddress(self): data = self.form_data.copy() data['email'] = 'test' form = RegistrationForm(data=data) self.assertFalse(form.is_valid())
def test_validRegistrationWithAcceptableProfileImage(self): data = self.form_data.copy() with open('fixtures/image1.jpg', 'rb') as img: data['file'] = SimpleUploadedFile(img.name, img.read()) form = RegistrationForm(data=data) self.assertTrue(form.is_valid())