本文整理汇总了Python中pybossa.forms.forms.RegisterForm类的典型用法代码示例。如果您正苦于以下问题:Python RegisterForm类的具体用法?Python RegisterForm怎么用?Python RegisterForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RegisterForm类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_register_name_reserved_name
def test_register_name_reserved_name(self):
self.fill_in_data['name'] = 'signin'
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert u'This name is used by the system.' in form.errors['name'], form.errors
示例2: test_register_fullname_length
def test_register_fullname_length(self):
self.fill_in_data['fullname'] = 'a'
form = RegisterForm(**self.fill_in_data)
error_message = "Full name must be between 3 and %s characters long" % USER_FULLNAME_MAX_LENGTH
assert not form.validate()
assert error_message in form.errors['fullname'], form.errors
示例3: test_register_email_length
def test_register_email_length(self):
self.fill_in_data['email_addr'] = ''
form = RegisterForm(**self.fill_in_data)
error_message = "Email must be between 3 and %s characters long" % EMAIL_MAX_LENGTH
assert not form.validate()
assert error_message in form.errors['email_addr'], form.errors
示例4: test_register_password_valid_password
def test_register_password_valid_password(self):
self.fill_in_data['password'] = self.fill_in_data['confirm'] = 'Abcd12345!'
form = RegisterForm(**self.fill_in_data)
assert form.validate()
示例5: test_register_password_missmatch
def test_register_password_missmatch(self):
self.fill_in_data['confirm'] = 'badpasswd'
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "Passwords must match" in form.errors['password'], form.errors
示例6: test_register_password_required
def test_register_password_required(self):
self.fill_in_data['password'] = ''
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "Password cannot be empty" in form.errors['password'], form.errors
示例7: test_register_email_valid_format
def test_register_email_valid_format(self):
self.fill_in_data['email_addr'] = 'notanemail'
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "Invalid email address." in form.errors['email_addr'], form.errors
示例8: test_register_form_unique_email
def test_register_form_unique_email(self):
form = RegisterForm(**self.fill_in_data)
user = UserFactory.create(email_addr='[email protected]')
assert not form.validate()
assert "Email is already taken" in form.errors['email_addr'], form.errors
示例9: test_register_name_allowed_chars
def test_register_name_allowed_chars(self):
self.fill_in_data['name'] = '$#&\/|'
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "$#&\\/| and space symbols are forbidden" in form.errors['name'], form.errors
示例10: test_register_form_unique_name
def test_register_form_unique_name(self):
form = RegisterForm(**self.fill_in_data)
user = UserFactory.create(name='mylion')
assert not form.validate()
assert "The user name is already taken" in form.errors['name'], form.errors
示例11: test_register_form_validates_with_valid_fields
def test_register_form_validates_with_valid_fields(self):
form = RegisterForm(**self.fill_in_data)
assert form.validate()
示例12: test_register_form_contains_fields
def test_register_form_contains_fields(self):
form = RegisterForm()
for field in self.fields:
assert form.__contains__(field), 'Field %s is not in form' %field
示例13: test_register_name_length
def test_register_name_length(self):
self.fill_in_data['name'] = 'a'
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "User name must be between 3 and 35 characters long" in form.errors['name'], form.errors
示例14: test_register_email_length
def test_register_email_length(self):
self.fill_in_data['email_addr'] = ''
form = RegisterForm(**self.fill_in_data)
assert not form.validate()
assert "Email must be between 3 and 35 characters long" in form.errors['email_addr'], form.errors