def test_profile_web_validation(self): """Profile.web should be a real URL. Even partial URLs are not allowed. """ profile = Profile() profile.web = 'foobar.com' with self.assertRaises(ValidationError) as err: profile.full_clean() expected_message = 'Enter a valid value.' message_list = err.exception.message_dict.get('web') self.assertEqual(expected_message, message_list[0])
def test_profile_update_web(self): """You should be able to update web for a Profile.""" profile = Profile() profile.web = 'http://example.com/' self.assertEqual('http://example.com/', profile.web)