本文整理汇总了Python中silver.tests.factories.ProformaFactory.reset_sequence方法的典型用法代码示例。如果您正苦于以下问题:Python ProformaFactory.reset_sequence方法的具体用法?Python ProformaFactory.reset_sequence怎么用?Python ProformaFactory.reset_sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silver.tests.factories.ProformaFactory
的用法示例。
在下文中一共展示了ProformaFactory.reset_sequence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_get_proforma
# 需要导入模块: from silver.tests.factories import ProformaFactory [as 别名]
# 或者: from silver.tests.factories.ProformaFactory import reset_sequence [as 别名]
def test_get_proforma(self):
ProformaFactory.reset_sequence(1)
proforma = ProformaFactory.create()
url = reverse('proforma-detail', kwargs={'pk': proforma.pk})
response = self.client.get(url)
assert response.status_code == status.HTTP_200_OK
assert response.data == {
"id": proforma.pk,
"series": "ProformaSeries",
"number": 1,
"provider": "http://testserver/providers/%s/" % proforma.provider.pk,
"customer": "http://testserver/customers/%s/" % proforma.customer.pk,
"archived_provider": {},
"archived_customer": {},
"due_date": None,
"issue_date": None,
"paid_date": None,
"cancel_date": None,
"sales_tax_name": "VAT",
"sales_tax_percent": '1.00',
"currency": "RON",
'pdf_url': None,
"state": "draft",
"invoice": None,
"proforma_entries": [],
'total': Decimal('0.00'),
}
示例2: test_get_proforma
# 需要导入模块: from silver.tests.factories import ProformaFactory [as 别名]
# 或者: from silver.tests.factories.ProformaFactory import reset_sequence [as 别名]
def test_get_proforma(self, mocked_settings):
ProformaFactory.reset_sequence(1)
upload_path = '%s/documents/' % settings.MEDIA_ROOT
proforma = ProformaFactory.create(pdf=PDF.objects.create(upload_path=upload_path))
proforma.generate_pdf()
url = reverse('proforma-detail', kwargs={'pk': proforma.pk})
for show_pdf_storage_url, pdf_url in [
(True, build_absolute_test_url(proforma.pdf.url)),
(False, build_absolute_test_url(reverse('pdf', args=[proforma.pdf.pk])))
]:
mocked_settings.SILVER_SHOW_PDF_STORAGE_URL = show_pdf_storage_url
response = self.client.get(url)
provider_url = build_absolute_test_url(reverse('provider-detail',
[proforma.provider.pk]))
customer_url = build_absolute_test_url(reverse('customer-detail',
[proforma.customer.pk]))
self.assertEqual(response.status_code, status.HTTP_200_OK)
self.assertEqual(response.data, {
"id": proforma.pk,
"series": "ProformaSeries",
"number": proforma.number,
"provider": provider_url,
"customer": customer_url,
"archived_provider": '{}',
"archived_customer": '{}',
"due_date": None,
"issue_date": None,
"paid_date": None,
"cancel_date": None,
"sales_tax_name": "VAT",
"sales_tax_percent": '1.00',
"currency": "RON",
"transaction_currency": proforma.transaction_currency,
"transaction_xe_rate": ("%.4f" % proforma.transaction_xe_rate
if proforma.transaction_xe_rate else None),
"transaction_xe_date": proforma.transaction_xe_date,
"pdf_url": pdf_url,
"state": "draft",
"invoice": None,
"proforma_entries": [],
"total": 0,
"total_in_transaction_currency": 0,
"transactions": []
})