'Run the upload_students_csv task and verify that the correct team was added to the CSV.'

def _generate_and_verify_teams_column(self, username, expected_team):

    current_task = Mock()
    current_task.update_state = Mock()
    task_input = ['id', 'username', 'name', 'email', 'language', 'location', 'year_of_birth', 'gender', 'level_of_education', 'mailing_address', 'goals', 'team']
    with patch('lms.djangoapps.instructor_task.tasks_helper.runner._get_current_task') as mock_current_task:
        mock_current_task.return_value = current_task
        result = upload_students_csv(None, None, self.course.id, task_input, 'calculated')
        self.assertDictContainsSubset({'attempted': 2, 'succeeded': 2, 'failed': 0}, result)
        report_store = ReportStore.from_config(config_name='GRADES_DOWNLOAD')
        report_csv_filename = report_store.links_for(self.course.id)[0][0]
        report_path = report_store.path_to(self.course.id, report_csv_filename)
        found_user = False
        with report_store.storage.open(report_path) as csv_file:
            for row in unicodecsv.DictReader(csv_file):
                if (row.get('username') == username):
                    self.assertEqual(row['team'], expected_team)
                    found_user = True
        self.assertTrue(found_user)
