当前位置: 首页>>代码示例>>Python>>正文


Python ProformaFactory.reset_sequence方法代码示例

本文整理汇总了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'),
        }
开发者ID:oucsaw,项目名称:silver,代码行数:31,代码来源:test_proforma.py

示例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": []
            })
开发者ID:PressLabs,项目名称:silver,代码行数:51,代码来源:test_proforma.py


注:本文中的silver.tests.factories.ProformaFactory.reset_sequence方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。