def test_get_provider(self): ProviderFactory.reset_sequence(1) provider = ProviderFactory.create() url = reverse('provider-detail', kwargs={'pk': provider.pk}) response = self.client.get(url) assert response.status_code == 200 expected = { 'id': provider.pk, 'url': 'http://testserver/providers/%s/' % provider.pk, '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
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
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': '*****@*****.**', 'address_1': 'Address11', 'address_2': 'Address21', 'city': 'City1', 'state': 'State1', 'zip_code': '1', 'country': u'AL', 'extra': 'Extra1', 'meta': {u'something': [1, 2]} }
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': '*****@*****.**', 'address_1': 'Address11', 'address_2': 'Address21', 'city': 'City1', 'state': 'State1', 'zip_code': '1', 'country': u'AL', 'extra': 'Extra1', 'meta': { u'something': [1, 2] } }
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': '*****@*****.**', 'notification_email': '*****@*****.**', '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': '*****@*****.**', 'notification_email': '*****@*****.**', '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 }
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': '*****@*****.**', '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, }
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': '*****@*****.**', '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, }
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, 'email': '*****@*****.**', '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] }, }
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': '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, }
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': '*****@*****.**', 'notification_email': '*****@*****.**', '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 }
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, }