'test to generate detailed enrollment report.
1 Purchase registration codes.
2 Enroll users via registration code.
3 Validate generated enrollment report.'

def test_bulk_purchase_detailed_report(self):

    paid_course_reg_item = PaidCourseRegistration.add_to_order(self.cart, self.course.id)
    resp = self.client.post(reverse('shoppingcart.views.update_user_cart', is_dashboard_endpoint=False), {'ItemId': paid_course_reg_item.id, 'qty': '4'})
    self.assertEqual(resp.status_code, 200)
    resp = self.client.post(reverse('shoppingcart.views.use_code', is_dashboard_endpoint=False), {'code': self.coupon_code})
    self.assertEqual(resp.status_code, 200)
    self.cart.purchase()
    course_reg_codes = CourseRegistrationCode.objects.filter(order=self.cart)
    self.register_with_redemption_code(self.instructor, course_reg_codes[0].code)
    test_user = UserFactory()
    test_user_cart = Order.get_cart_for_user(test_user)
    PaidCourseRegistration.add_to_order(test_user_cart, self.course.id)
    test_user_cart.purchase()
    InvoiceTransaction.objects.create(invoice=self.sale_invoice_1, amount=(- self.sale_invoice_1.total_amount), status='refunded', created_by=self.instructor, last_modified_by=self.instructor)
    course_registration_code = CourseRegistrationCode.objects.create(code='abcde', course_id=self.course.id.to_deprecated_string(), created_by=self.instructor, invoice=self.sale_invoice_1, invoice_item=self.invoice_item, mode_slug='honor')
    test_user1 = UserFactory()
    self.register_with_redemption_code(test_user1, course_registration_code.code)
    CourseFinanceAdminRole(self.course.id).add_users(self.instructor)
    self.client.login(username=self.instructor.username, password='test')
    url = reverse('get_enrollment_report', kwargs={'course_id': self.course.id.to_deprecated_string()})
    response = self.client.post(url, {})
    self.assertIn('The    detailed    enrollment    report    is    being    created.', response.content)
