'Verify that enrollments are changed correctly when org was given.'

@patch('student.models.tracker')
@ddt.data(('audit', 'no-id-professional'), ('no-id-professional', 'audit'))
@ddt.unpack
def test_bulk_convert_with_org(self, from_mode, to_mode, mock_tracker):

    self._enroll_users(self.course, self.users, from_mode)
    CourseModeFactory(course_id=self.course.id, mode_slug=to_mode)
    course_2 = CourseFactory.create(org=self.org)
    CourseModeFactory(course_id=course_2.id, mode_slug=to_mode)
    CourseOverview.load_from_module_store(course_2.id)
    self._enroll_users(course_2, self.users, from_mode)
    self.assertEqual(len(CourseEnrollment.objects.filter(mode=to_mode, course_id=self.course.id)), 0)
    self.assertEqual(len(CourseEnrollment.objects.filter(mode=to_mode, course_id=course_2.id)), 0)
    call_command('bulk_change_enrollment', org=self.org, from_mode=from_mode, to_mode=to_mode, commit=True)
    for user in self.users:
        for course in [self.course, course_2]:
            CourseEnrollment.objects.get(mode=to_mode, course_id=course.id, user=user)
            self._assert_mode_changed(mock_tracker, course, user, to_mode)
