'Verify the transfer student command works as intended.'

def test_transfer_students(self):

    student = UserFactory.create()
    student.set_password(self.PASSWORD)
    student.save()
    mode = 'verified'
    original_course_location = locator.CourseLocator('Org0', 'Course0', 'Run0')
    course = self._create_course(original_course_location)
    CourseEnrollment.enroll(student, course.id, mode='verified')
    self._create_and_purchase_verified(student, course.id)
    course_location_one = locator.CourseLocator('Org1', 'Course1', 'Run1')
    new_course_one = self._create_course(course_location_one)
    course_location_two = locator.CourseLocator('Org2', 'Course2', 'Run2')
    new_course_two = self._create_course(course_location_two)
    original_key = unicode(course.id)
    new_key_one = unicode(new_course_one.id)
    new_key_two = unicode(new_course_two.id)
    transfer_students.Command().handle(source_course=original_key, dest_course_list=((new_key_one + ',') + new_key_two))
    self.assertTrue(self.signal_fired)
    self.mock_tracker.emit.assert_has_calls([call(EVENT_NAME_ENROLLMENT_ACTIVATED, {'course_id': original_key, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_MODE_CHANGED, {'course_id': original_key, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_DEACTIVATED, {'course_id': original_key, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_ACTIVATED, {'course_id': new_key_one, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_MODE_CHANGED, {'course_id': new_key_one, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_ACTIVATED, {'course_id': new_key_two, 'user_id': student.id, 'mode': mode}), call(EVENT_NAME_ENROLLMENT_MODE_CHANGED, {'course_id': new_key_two, 'user_id': student.id, 'mode': mode})])
    self.mock_tracker.reset_mock()
    self.assertEquals((mode, False), CourseEnrollment.enrollment_mode_for_user(student, course.id))
    self.assertEquals((mode, True), CourseEnrollment.enrollment_mode_for_user(student, new_course_one.id))
    self.assertEquals((mode, True), CourseEnrollment.enrollment_mode_for_user(student, new_course_two.id))
    target_certs = CertificateItem.objects.filter(course_id=course.id, user_id=student, status='purchased', mode=mode)
    self.assertTrue(target_certs[0])
    self.assertFalse(target_certs[0].refund_requested_time)
    self.assertEquals(target_certs[0].order.status, 'purchased')
