def test_clean_with_validation_error(self, course_run_state): """ Verify that 'clean' raises 'ValidationError' for invalid course run state """ run_state_form = CourseRunStateAdminForm() run_state_form.cleaned_data = {'name': course_run_state, 'owner_role': PublisherUserRole.Publisher} with self.assertRaises(ValidationError): run_state_form.clean()
def test_clean_without_validation_error(self): """ Verify that 'clean' does not raise 'ValidationError' for valid course run state """ run_state_form = CourseRunStateAdminForm() run_state_form.cleaned_data = { 'name': CourseRunStateChoices.Approved, 'owner_role': PublisherUserRole.Publisher } self.assertEqual(run_state_form.clean(), run_state_form.cleaned_data)