Skip to content

Instantly share code, notes, and snippets.

@kriwil
Created September 29, 2014 07:41
Show Gist options
  • Save kriwil/40088a48ae61c25bc029 to your computer and use it in GitHub Desktop.
Save kriwil/40088a48ae61c25bc029 to your computer and use it in GitHub Desktop.
class CreatePaymentTest(TestCase):
def setUp(self):
self.user = UserFactory()
self.payment = PaymentFactory()
self.product = ProductFactory()
self.url = reverse('api:create-payment')
self.headers = get_auth_header(self.user)
def test_post_new(self):
UserFactory()
ProductFactory()
# list_product = [{"product": 1, "item_count": 10, "month_subscription": 5}]
list_product = [{'product': 1, 'item_count': 10, 'month_subscription': 5}]
post_data = {
"user": self.user.id,
"payment_type": 'manual',
"total": '0',
"list_product": list_product
}
response = self.client.post(self.url, json.dumps(post_data), content_type='application/json', **self.headers)
self.assertEqual(response.status_code, 201)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment