def test_no_empty_strings_in_employee_skills(self): test_employee = Employee(last_name='test', first_name='test', job_title='test', job_description='test', bio='test', skills='test') test_employee.skills = '' with self.assertRaises(ValidationError): test_employee.full_clean() test_employee.save()
def test_max_length_on_employee_skills(self): test_employee = Employee(last_name='test', first_name='test', job_title='test', job_description='test', bio='test', skills='test') test_employee.skills = 't' * 1001 with self.assertRaises(ValidationError): test_employee.full_clean() test_employee.save()
def test_employee_skills_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.skills = 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.skills)