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


Python ProviderFactory.reset_sequence方法代码示例

本文整理汇总了Python中silver.tests.factories.ProviderFactory.reset_sequence方法的典型用法代码示例。如果您正苦于以下问题:Python ProviderFactory.reset_sequence方法的具体用法?Python ProviderFactory.reset_sequence怎么用?Python ProviderFactory.reset_sequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在silver.tests.factories.ProviderFactory的用法示例。


在下文中一共展示了ProviderFactory.reset_sequence方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_get_provider

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_get_provider(self):
        ProviderFactory.reset_sequence(1)
        ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': 1})

        response = self.client.get(url)

        assert response.status_code == 200
        assert response.data == {
            'id': 1,
            'url': 'http://testserver/providers/1/',
            'name': 'Name1',
            'company': 'Company1',
            'flow': 'proforma',
            'invoice_series': 'InvoiceSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1,
            'email': '[email protected]',
            'address_1': 'Address11',
            'address_2': 'Address21',
            'city': 'City1',
            'state': 'State1',
            'zip_code': '1',
            'country': u'AL',
            'extra': 'Extra1',
            'meta': {u'something': [1, 2]}
        }
开发者ID:Athenolabs,项目名称:silver,代码行数:31,代码来源:test_provider.py

示例2: test_get_provider

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_get_provider(self):
        ProviderFactory.reset_sequence(1)
        provider = ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': 1})

        response = self.client.get(url)

        assert response.status_code == 200
        expected = {
            'id': 1,
            'url': 'http://testserver/providers/1/',
            'name': provider.name,
            'company': provider.company,
            'flow': provider.flow,
            'invoice_series': provider.invoice_series,
            'invoice_starting_number': provider.invoice_starting_number,
            'proforma_series': provider.proforma_series,
            'proforma_starting_number': provider.proforma_starting_number,
            'email': provider.email,
            'address_1': provider.address_1,
            'address_2': provider.address_2,
            'city': provider.city,
            'state': provider.state,
            'zip_code': provider.zip_code,
            'country': provider.country,
            'extra': provider.extra,
            'meta': {u'something': [1, 2]}
        }
        assert response.data == expected
开发者ID:MaxMorais,项目名称:silver,代码行数:32,代码来源:test_provider.py

示例3: test_put_provider_correctly

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_put_provider_correctly(self):
        ProviderFactory.reset_sequence(1)
        provider = ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': provider.pk})
        new_data = {
            'id': provider.pk,
            'url': 'http://testserver/providers/%s/' % provider.pk,
            'name': 'TestProvider',
            'company': 'TheNewCompany',
            'display_email': '[email protected]',
            'notification_email': '[email protected]',
            'address_1': 'address',
            'city': 'City',
            'zip_code': '1',
            'country': 'RO',
            'flow': 'proforma',
            'invoice_series': 'NewSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1
            # TODO: add new meta JSON value
        }

        response = self.client.put(url, data=new_data)

        assert response.status_code == status.HTTP_200_OK
        assert response.data == {
            'id': provider.pk,
            'url': 'http://testserver/providers/%s/' % provider.pk,
            'name': 'TestProvider',
            'company': 'TheNewCompany',
            'flow': 'proforma',
            'display_email': '[email protected]',
            'notification_email': '[email protected]',
            'address_1': 'address',
            'address_2': u'Addåress21',
            'city': 'City',
            'state': 'State1',
            'zip_code': '1',
            'country': 'RO',
            'extra': 'Extra1',
            'flow': 'proforma',
            'invoice_series': 'NewSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1,
            'meta': {u'something': [1, 2]},
            'payment_processors': 'http://testserver/providers/%s/payment_processors/' % provider.pk
        }
开发者ID:oucsaw,项目名称:silver,代码行数:52,代码来源:test_provider.py

示例4: test_put_provider_correctly

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_put_provider_correctly(self):
        ProviderFactory.reset_sequence(1)
        provider = ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': provider.pk})
        new_data = {
            'id': provider.pk,
            'name': 'TestProvider',
            'company': 'TheNewCompany',
            'email': '[email protected]',
            'address_1': 'address',
            'city': 'City',
            'zip_code': '1',
            'country': 'RO',
            'flow': 'proforma',
            'invoice_series': 'NewSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1
            # TODO: add new meta JSON value
        }

        response = self.client.put(url, data=new_data)

        assert response.status_code == status.HTTP_200_OK

        self_url = build_absolute_test_url(url)
        assert response.data == {
            'id': provider.pk,
            'url': self_url,
            'name': new_data['name'],
            'company': new_data['company'],
            'flow': provider.flow,
            'email': new_data['email'],
            'address_1': new_data['address_1'],
            'address_2': provider.address_2,
            'city': new_data['city'],
            'state': provider.state,
            'zip_code': new_data['zip_code'],
            'country': new_data['country'],
            'extra': provider.extra,
            'flow': new_data['flow'],
            'invoice_series': new_data['invoice_series'],
            'invoice_starting_number': new_data['invoice_starting_number'],
            'proforma_series': new_data['proforma_series'],
            'proforma_starting_number': new_data['proforma_starting_number'],
            'meta': provider.meta,
        }
开发者ID:PressLabs,项目名称:silver,代码行数:50,代码来源:test_provider.py

示例5: test_patch_provider

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_patch_provider(self):
        ProviderFactory.reset_sequence(1)
        provider = ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': provider.pk})

        new_data = {
            'company': 'TheNewCompany',  # The changed field
            'address_1': 'Address11',
            'flow': 'proforma',
            'invoice_series': 'InvoiceSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1,
            'city': 'City1',
            'zip_code': '1',
            'country': u'AL',
        }

        response = self.client.patch(url, data=new_data)

        assert response.status_code == 200
        assert response.data == {
            'id': provider.pk,
            'url': 'http://testserver/providers/%s/' % provider.pk,
            'name': u'Náme1',
            'company': u'TheNewCompany',
            'flow': 'proforma',
            'invoice_series': 'InvoiceSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1,
            'display_email': '[email protected]',
            'notification_email': '[email protected]',
            'address_1': 'Address11',
            'address_2': u'Addåress21',
            'city': 'City1',
            'state': 'State1',
            'zip_code': '1',
            'country': u'AL',
            'extra': 'Extra1',
            'meta': {u'something': [1, 2]},
            'payment_processors': 'http://testserver/providers/%s/payment_processors/' % provider.pk
        }
开发者ID:oucsaw,项目名称:silver,代码行数:46,代码来源:test_provider.py

示例6: test_patch_provider

# 需要导入模块: from silver.tests.factories import ProviderFactory [as 别名]
# 或者: from silver.tests.factories.ProviderFactory import reset_sequence [as 别名]
    def test_patch_provider(self):
        ProviderFactory.reset_sequence(1)
        provider = ProviderFactory.create()

        url = reverse('provider-detail', kwargs={'pk': provider.pk})

        new_data = {
            'company': 'TheNewCompany',  # The changed field
            'address_1': 'Address11',
            'flow': 'proforma',
            'invoice_series': 'InvoiceSeries',
            'invoice_starting_number': 1,
            'proforma_series': 'ProformaSeries',
            'proforma_starting_number': 1,
            'city': 'City1',
            'zip_code': '1',
            'country': u'AL',
        }

        response = self.client.patch(url, data=new_data)

        assert response.status_code == 200

        self_url = build_absolute_test_url(url)
        assert response.data == {
            'id': provider.pk,
            'url': self_url,
            'name': provider.name,
            'company': new_data['company'],
            'flow': new_data['flow'],
            'invoice_series': new_data['invoice_series'],
            'invoice_starting_number': new_data['invoice_starting_number'],
            'proforma_series': new_data['proforma_series'],
            'proforma_starting_number': new_data['proforma_starting_number'],
            'email': provider.email,
            'address_1': new_data['address_1'],
            'address_2': provider.address_2,
            'city': new_data['city'],
            'state': provider.state,
            'zip_code': new_data['zip_code'],
            'country': new_data['country'],
            'extra': provider.extra,
            'meta': provider.meta,
        }
开发者ID:PressLabs,项目名称:silver,代码行数:46,代码来源:test_provider.py


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