'Dry method for course enrollment and adding request to
queue. Returns a mock object containing information about the
`XQueueInterface.send_to_queue` method, which can be used in other
assertions.'

def add_cert_to_queue(self, mode):

    CourseEnrollmentFactory(user=self.user_2, course_id=self.course.id, is_active=True, mode=mode)
    with mock_passing_grade():
        with patch.object(XQueueInterface, 'send_to_queue') as mock_send:
            mock_send.return_value = (0, None)
            self.xqueue.add_cert(self.user_2, self.course.id)
            return mock_send
