def test_create_no_attributes(self): """Try and create a supervisor without setting any attributes This should fail with ValidationError """ supervisor = Supervisor() with self.assertRaises(ValidationError): supervisor.full_clean()
def test_valid_websites(self): """Try and submit supervisor with various valid website URLs This should pass """ supervisor = Supervisor() supervisor.first_name = 'Arthur' supervisor.last_name = 'Anderson' supervisor.email = '*****@*****.**' for u in valid_urls: supervisor.website = u supervisor.full_clean()
def test_invalid_websites(self): """Try and submit supervisor with an invalid website URL This should fail with ValidationError """ supervisor = Supervisor() supervisor.first_name = 'Arthur' supervisor.last_name = 'Anderson' supervisor.email = '*****@*****.**' for u in invalid_urls: supervisor.website = u with self.assertRaises(ValidationError): supervisor.full_clean()
def test_create_necessary_attributes(self): """Try and create a supervisor with the necessary attributes This should pass """ supervisor = Supervisor() supervisor.first_name = 'Arthur' supervisor.last_name = 'Anderson' supervisor.email = '*****@*****.**' supervisor.full_clean()