def test_skype_validator(self): # space user = CtsUserFactory(skype='aaa aaa') with self.assertRaises(ValidationError): user.full_clean() # starts with non-letter user.skype = '$asdfasdf' with self.assertRaises(ValidationError): user.full_clean() # < 5 chars user.skype = 'asdff' with self.assertRaises(ValidationError): user.full_clean() # > 32 chars user.skype = ''.join(random.choice(string.lowercase) for i in range(33)) with self.assertRaises(ValidationError): user.full_clean() user.skype = ''.join(random.choice(string.lowercase) for i in range(10)) user.full_clean()
def test_hex_color(self): # missing # user = CtsUserFactory(colour='555aaa') with self.assertRaises(ValidationError): user.full_clean() # not 3 or 6 user = CtsUserFactory(colour='#5544') with self.assertRaises(ValidationError): user.full_clean() # alpha out of range user = CtsUserFactory(colour='#JJJKKK') with self.assertRaises(ValidationError): user.full_clean() # short version user.colour = '#FFF' user.full_clean() # long version user.colour = '#FFFCCC' user.full_clean()
def test_skype_validator(self): # space user = CtsUserFactory(skype='aaa aaa') with self.assertRaises(ValidationError): user.full_clean() # starts with non-letter user.skype = '$asdfasdf' with self.assertRaises(ValidationError): user.full_clean() # < 5 chars user.skype = 'asdff' with self.assertRaises(ValidationError): user.full_clean() # > 32 chars user.skype = ''.join( random.choice(string.lowercase) for i in range(33)) with self.assertRaises(ValidationError): user.full_clean() user.skype = ''.join( random.choice(string.lowercase) for i in range(10)) user.full_clean()
def test_mobile_validator(self): # text user = CtsUserFactory(mobile='555aaa') with self.assertRaises(ValidationError): user.full_clean() # optional + user.mobile = '+555' user.full_clean() # optional - user.mobile = '555-555-555' user.full_clean()