def test_no_empty_strings_in_employee_bio(self): test_employee = Employee(last_name='test', first_name='test', job_title='test', job_description='test', bio='test', skills='test') test_employee.bio = '' with self.assertRaises(ValidationError): test_employee.full_clean() test_employee.save()
def test_max_length_on_employee_bio(self): test_employee = Employee(last_name='test', first_name='test', job_title='test', job_description='test', bio='test', skills='test') test_employee.bio = 't' * 1001 with self.assertRaises(ValidationError): test_employee.full_clean() test_employee.save()
def test_employee_bio_can_be_overwritten(self): test_employee = Employee(last_name='test', first_name='test', job_title='test', job_description='test', bio='test', skills='test') test_employee.full_clean() test_employee.save() changed_string = "CHANGED" expected = changed_string test_employee.bio = changed_string test_employee.full_clean test_employee.save() test_employee_from_db = Employee.objects.get(pk=1) self.assertEqual(expected, test_employee_from_db.bio)