本文整理汇总了Python中shoppingcart.views.initialize_report函数的典型用法代码示例。如果您正苦于以下问题:Python initialize_report函数的具体用法?Python initialize_report怎么用?Python initialize_report使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了initialize_report函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_purchased_items_btw_dates
def test_purchased_items_btw_dates(self):
report = initialize_report("itemized_purchase_report", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS)
purchases = report.rows()
# since there's not many purchases, just run through the generator to make sure we've got the right number
self.assertEqual(len(list(purchases)), 2)
report = initialize_report("itemized_purchase_report", self.now + self.FIVE_MINS, self.now + self.FIVE_MINS + self.FIVE_MINS)
no_purchases = report.rows()
self.assertEqual(len(list(no_purchases)), 0)
开发者ID:CraftAcademy,项目名称:edx-platform,代码行数:10,代码来源:test_reports.py
示例2: test_purchased_items_btw_dates
def test_purchased_items_btw_dates(self):
report = initialize_report("itemized_purchase_report", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS)
purchases = report.rows()
# since there's not many purchases, just run through the generator to make sure we've got the right number
num_purchases = 0
for item in purchases:
num_purchases += 1
self.assertEqual(num_purchases, 2)
report = initialize_report("itemized_purchase_report", self.now + self.FIVE_MINS, self.now + self.FIVE_MINS + self.FIVE_MINS)
no_purchases = report.rows()
num_purchases = 0
for item in no_purchases:
num_purchases += 1
self.assertEqual(num_purchases, 0)
开发者ID:TabEd,项目名称:edx-platform,代码行数:17,代码来源:test_reports.py
示例3: test_basic_uni_revenue_share_csv
def test_basic_uni_revenue_share_csv(self):
report = initialize_report(
"university_revenue_share", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS, "A", "Z"
)
csv_file = StringIO.StringIO()
report.write_csv(csv_file)
csv = csv_file.getvalue()
self.assertEqual(csv.replace("\r\n", "\n").strip(), self.CORRECT_UNI_REVENUE_SHARE_CSV.strip())
开发者ID:morsoinferno,项目名称:ANALYSE,代码行数:8,代码来源:test_reports.py
示例4: test_refund_report_rows
def test_refund_report_rows(self):
report = initialize_report("refund_report", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS)
refunded_certs = report.rows()
# check that we have the right number
self.assertEqual(len(list(refunded_certs)), 2)
self.assertTrue(CertificateItem.objects.get(user=self.first_refund_user, course_id=self.course_key))
self.assertTrue(CertificateItem.objects.get(user=self.second_refund_user, course_id=self.course_key))
开发者ID:CraftAcademy,项目名称:edx-platform,代码行数:9,代码来源:test_reports.py
示例5: test_purchased_csv
def test_purchased_csv(self):
"""
Tests that a generated purchase report CSV is as we expect
"""
report = initialize_report("itemized_purchase_report", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS)
csv_file = StringIO.StringIO()
report.write_csv(csv_file)
csv = csv_file.getvalue()
csv_file.close()
# Using excel mode csv, which automatically ends lines with \r\n, so need to convert to \n
self.assertEqual(csv.replace('\r\n', '\n').strip(), self.CORRECT_CSV.strip())
开发者ID:CraftAcademy,项目名称:edx-platform,代码行数:11,代码来源:test_reports.py
示例6: test_report_csv_itemized
def test_report_csv_itemized(self):
report_type = 'itemized_purchase_report'
start_date = '1970-01-01'
end_date = '2100-01-01'
PaidCourseRegistration.add_to_order(self.cart, self.course_key)
self.cart.purchase()
self.login_user()
self.add_to_download_group(self.user)
response = self.client.post(reverse('payment_csv_report'), {'start_date': start_date,
'end_date': end_date,
'requested_report': report_type})
self.assertEqual(response['Content-Type'], 'text/csv')
report = initialize_report(report_type, start_date, end_date)
self.assertIn(",".join(report.header()), response.content)
self.assertIn(self.CORRECT_CSV_NO_DATE_ITEMIZED_PURCHASE, response.content)
开发者ID:Appius,项目名称:edx-platform,代码行数:15,代码来源:test_views.py
示例7: test_report_csv_university_revenue_share
def test_report_csv_university_revenue_share(self):
report_type = 'university_revenue_share'
start_date = '1970-01-01'
end_date = '2100-01-01'
start_letter = 'A'
end_letter = 'Z'
self.login_user()
self.add_to_download_group(self.user)
response = self.client.post(reverse('payment_csv_report'), {'start_date': start_date,
'end_date': end_date,
'start_letter': start_letter,
'end_letter': end_letter,
'requested_report': report_type})
self.assertEqual(response['Content-Type'], 'text/csv')
report = initialize_report(report_type, start_date, end_date, start_letter, end_letter)
self.assertIn(",".join(report.header()), response.content)
开发者ID:Appius,项目名称:edx-platform,代码行数:16,代码来源:test_views.py
示例8: test_report_csv_itemized
def test_report_csv_itemized(self):
report_type = "itemized_purchase_report"
start_date = "1970-01-01"
end_date = "2100-01-01"
PaidCourseRegistration.add_to_order(self.cart, self.course_id)
self.cart.purchase()
self.login_user()
self.add_to_download_group(self.user)
response = self.client.post(
reverse("payment_csv_report"),
{"start_date": start_date, "end_date": end_date, "requested_report": report_type},
)
self.assertEqual(response["Content-Type"], "text/csv")
report = initialize_report(report_type, start_date, end_date)
self.assertIn(",".join(report.header()), response.content)
self.assertIn(self.CORRECT_CSV_NO_DATE_ITEMIZED_PURCHASE, response.content)
开发者ID:jlblancom,项目名称:edx-platform,代码行数:16,代码来源:test_views.py
示例9: test_report_csv_university_revenue_share
def test_report_csv_university_revenue_share(self):
report_type = "university_revenue_share"
start_date = "1970-01-01"
end_date = "2100-01-01"
start_letter = "A"
end_letter = "Z"
self.login_user()
self.add_to_download_group(self.user)
response = self.client.post(
reverse("payment_csv_report"),
{
"start_date": start_date,
"end_date": end_date,
"start_letter": start_letter,
"end_letter": end_letter,
"requested_report": report_type,
},
)
self.assertEqual(response["Content-Type"], "text/csv")
report = initialize_report(report_type, start_date, end_date, start_letter, end_letter)
self.assertIn(",".join(report.header()), response.content)
开发者ID:jlblancom,项目名称:edx-platform,代码行数:21,代码来源:test_views.py
示例10: test_basic_cert_status_csv
def test_basic_cert_status_csv(self):
report = initialize_report("certificate_status", self.now - self.FIVE_MINS, self.now + self.FIVE_MINS, 'A', 'Z')
csv_file = StringIO.StringIO()
report.write_csv(csv_file)
csv = csv_file.getvalue()
self.assertEqual(csv.replace('\r\n', '\n').strip(), self.CORRECT_CERT_STATUS_CSV.strip())
开发者ID:CraftAcademy,项目名称:edx-platform,代码行数:6,代码来源:test_reports.py
注:本文中的shoppingcart.views.initialize_report函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论