'Test that enrollment mode for unpaid honor courses is \'honor\'.'

@patch.dict(settings.FEATURES, {'ALLOW_AUTOMATED_SIGNUPS': True})
def test_honor_enrollment_mode(self):

    self.white_label_course_mode.min_price = 0
    self.white_label_course_mode.suggested_prices = ''
    self.white_label_course_mode.save()
    self.client.login(username=self.white_label_course_instructor.username, password='test')
    csv_content = 'test_student_wl@example.com,test_student_wl,Test    Student,USA'
    uploaded_file = SimpleUploadedFile('temp.csv', csv_content)
    response = self.client.post(self.white_label_course_url, {'students_list': uploaded_file})
    self.assertEqual(response.status_code, 200)
    data = json.loads(response.content)
    self.assertEquals(len(data['row_errors']), 0)
    self.assertEquals(len(data['warnings']), 0)
    self.assertEquals(len(data['general_errors']), 0)
    manual_enrollments = ManualEnrollmentAudit.objects.all()
    self.assertEqual(manual_enrollments.count(), 1)
    self.assertEqual(manual_enrollments[0].state_transition, UNENROLLED_TO_ENROLLED)
    for enrollment in manual_enrollments:
        self.assertEqual(enrollment.enrollment.mode, CourseMode.HONOR)
