kopia lustrzana https://github.com/longclawshop/longclaw
More tests
rodzic
2b01cc098d
commit
bf57748c2d
|
|
@ -0,0 +1,26 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.10.5 on 2017-05-26 21:04
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('longclaworders', '0008_auto_20170516_1629'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='order',
|
||||||
|
name='billing_address',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_billing_address', to='longclawshipping.Address'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='order',
|
||||||
|
name='shipping_address',
|
||||||
|
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orders_shipping_address', to='longclawshipping.Address'),
|
||||||
|
),
|
||||||
|
]
|
||||||
|
|
@ -25,11 +25,11 @@ class Order(models.Model):
|
||||||
|
|
||||||
# shipping info
|
# shipping info
|
||||||
shipping_address = models.ForeignKey(
|
shipping_address = models.ForeignKey(
|
||||||
Address, blank=True, related_name="orders_shipping_address")
|
Address, blank=True, null=True, related_name="orders_shipping_address")
|
||||||
|
|
||||||
# billing info
|
# billing info
|
||||||
billing_address = models.ForeignKey(
|
billing_address = models.ForeignKey(
|
||||||
Address, blank=True, related_name="orders_billing_address")
|
Address, blank=True, null=True, related_name="orders_billing_address")
|
||||||
|
|
||||||
shipping_rate = models.DecimalField(max_digits=12,
|
shipping_rate = models.DecimalField(max_digits=12,
|
||||||
decimal_places=2,
|
decimal_places=2,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,12 @@
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
# Create your tests here.
|
from longclaw.tests.utils import LongclawTestCase, OrderFactory
|
||||||
|
|
||||||
|
class OrderApiTests(LongclawTestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.order = OrderFactory()
|
||||||
|
|
||||||
|
def test_fulfill_order(self):
|
||||||
|
self.post_test({}, 'longclaw_fulfill_order', urlkwargs={'pk': self.order.id})
|
||||||
|
|
|
||||||
|
|
@ -6,9 +6,11 @@ from django.conf.urls import url, include
|
||||||
from longclaw.longclawbasket.urls import urlpatterns as basket_urls
|
from longclaw.longclawbasket.urls import urlpatterns as basket_urls
|
||||||
from longclaw.longclawcheckout.urls import urlpatterns as checkout_urls
|
from longclaw.longclawcheckout.urls import urlpatterns as checkout_urls
|
||||||
from longclaw.longclawshipping.urls import urlpatterns as shipping_urls
|
from longclaw.longclawshipping.urls import urlpatterns as shipping_urls
|
||||||
|
from longclaw.longclaworders.urls import urlpatterns as orders_urls
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'', include(basket_urls)),
|
url(r'', include(basket_urls)),
|
||||||
url(r'', include(checkout_urls)),
|
url(r'', include(checkout_urls)),
|
||||||
url(r'', include(shipping_urls)),
|
url(r'', include(shipping_urls)),
|
||||||
|
url(r'', include(orders_urls))
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ class LongclawTestCase(APITestCase):
|
||||||
'''
|
'''
|
||||||
response = self.client.post(reverse(urlname, kwargs=urlkwargs), data, **kwargs)
|
response = self.client.post(reverse(urlname, kwargs=urlkwargs), data, **kwargs)
|
||||||
self.assertIn(response.status_code,
|
self.assertIn(response.status_code,
|
||||||
(status.HTTP_201_CREATED, status.HTTP_200_OK))
|
(status.HTTP_201_CREATED, status.HTTP_200_OK, status.HTTP_204_NO_CONTENT))
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def patch_test(self, data, urlname, urlkwargs=None, **kwargs):
|
def patch_test(self, data, urlname, urlkwargs=None, **kwargs):
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue