'Assert that the unenroll method is called or not based on the cert status'

@ddt.data(('notpassing', 200), ('restricted', 200), ('processing', 200), (None, 200), ('generating', 400), ('ready', 400))
@ddt.unpack
@patch.object(CourseEnrollment, 'unenroll')
def test_unenroll_request(self, cert_status, status_code, course_enrollment):

    self.cert_status = cert_status
    with patch('student.views.cert_info', side_effect=self.mock_cert):
        with patch('commerce.signals.handle_refund_order') as mock_refund_handler:
            REFUND_ORDER.connect(mock_refund_handler)
            response = self.client.post(reverse('change_enrollment'), {'enrollment_action': 'unenroll', 'course_id': self.course.id})
            self.assertEqual(response.status_code, status_code)
            if (status_code == 200):
                course_enrollment.assert_called_with(self.user, self.course.id)
                self.assertTrue(mock_refund_handler.called)
            else:
                course_enrollment.assert_not_called()
