kopia lustrzana https://github.com/longclawshop/longclaw
More tests
rodzic
bf57748c2d
commit
f027664862
|
@ -1,3 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
|
@ -10,6 +10,7 @@ from longclaw.tests.utils import LongclawTestCase, AddressFactory, BasketItemFac
|
||||||
from longclaw.longclawcheckout.utils import create_order
|
from longclaw.longclawcheckout.utils import create_order
|
||||||
from longclaw.longclawcheckout.forms import CheckoutForm
|
from longclaw.longclawcheckout.forms import CheckoutForm
|
||||||
from longclaw.longclawcheckout.views import CheckoutView
|
from longclaw.longclawcheckout.views import CheckoutView
|
||||||
|
from longclaw.longclawcheckout.templatetags import longclawcheckout_tags as tags
|
||||||
from longclaw.longclawbasket.utils import basket_id
|
from longclaw.longclawbasket.utils import basket_id
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,3 +180,13 @@ class CheckoutTest(TestCase):
|
||||||
self.assertEqual(response.status_code, 200)
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class GatewayTests(TestCase):
|
||||||
|
|
||||||
|
def test_token_tag(self):
|
||||||
|
token = tags.gateway_token()
|
||||||
|
self.assertIsInstance(token, str)
|
||||||
|
|
||||||
|
def test_js_tag(self):
|
||||||
|
js = tags.gateway_client_js()
|
||||||
|
self.assertIsInstance(js, (tuple, list))
|
|
@ -1,3 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
|
@ -1,3 +0,0 @@
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
# Register your models here.
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
from django.test import TestCase
|
||||||
|
from datetime import datetime
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from longclaw.longclawstats import stats
|
||||||
|
from longclaw.tests.utils import OrderFactory
|
||||||
|
|
||||||
|
class StatsTest(TestCase):
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
order = OrderFactory()
|
||||||
|
order.payment_date = datetime.now()
|
||||||
|
order.save()
|
||||||
|
|
||||||
|
def test_current_month(self):
|
||||||
|
start, end = stats.current_month()
|
||||||
|
self.assertEqual(start.month, end.month)
|
||||||
|
self.assertEqual(start.day, 1)
|
||||||
|
self.assertIn(end.day, [28, 29, 30, 31])
|
||||||
|
|
||||||
|
def test_sales_for_time_period(self):
|
||||||
|
delta = timedelta(days=1)
|
||||||
|
sales = stats.sales_for_time_period(datetime.now() - delta, datetime.now() + delta)
|
||||||
|
self.assertEqual(sales.count(), 1)
|
|
@ -49,6 +49,7 @@ INSTALLED_APPS = [
|
||||||
'longclaw.longclaworders',
|
'longclaw.longclaworders',
|
||||||
'longclaw.longclawcheckout',
|
'longclaw.longclawcheckout',
|
||||||
'longclaw.longclawbasket',
|
'longclaw.longclawbasket',
|
||||||
|
'longclaw.longclawstats',
|
||||||
'longclaw.tests.products',
|
'longclaw.tests.products',
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -8,7 +8,7 @@ envlist =
|
||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = {toxinidir}:{toxinidir}/longclaw
|
PYTHONPATH = {toxinidir}:{toxinidir}/longclaw
|
||||||
commands = coverage run --source longclaw runtests.py
|
commands = coverage run --source longclaw runtests.py
|
||||||
coverage xml --omit=apps.py,*/migrations/*,*/__init__.py
|
coverage xml --omit=*/apps.py,*/migrations/*,*/__init__.py
|
||||||
deps =
|
deps =
|
||||||
django-18: Django>=1.8,<1.9
|
django-18: Django>=1.8,<1.9
|
||||||
django-19: Django>=1.9,<1.10
|
django-19: Django>=1.9,<1.10
|
||||||
|
|
Ładowanie…
Reference in New Issue