'The command should update the user\'s enrollment.'

@patch('student.management.commands.change_enrollment.logger')
@ddt.data(('email', False, 3), ('username', False, 3), ('email', True, 0), ('username', True, 0))
@ddt.unpack
def test_convert_users(self, method, noop, expected_conversions, mock_logger):

    user_str = ','.join([getattr(user, method) for user in self.users])
    user_ids = [u.id for u in self.users]
    command_args = {'course_id': unicode(self.course.id), 'to_mode': 'honor', 'from_mode': 'audit', 'noop': noop, method: user_str}
    self.assertEqual(len(CourseEnrollment.objects.filter(mode='honor', user_id__in=user_ids)), 0)
    call_command('change_enrollment', **command_args)
    self.assertEqual(len(CourseEnrollment.objects.filter(mode='honor', user_id__in=user_ids)), expected_conversions)
    mock_logger.info.assert_called_with('Successfully    updated    %i    out    of    %i    users', len(self.users), len(self.users))
