|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+#!/usr/bin/env python
|
|
|
2
|
+import sys
|
|
|
3
|
+import os
|
|
|
4
|
+
|
|
|
5
|
+from django.conf import settings, global_settings
|
|
|
6
|
+
|
|
|
7
|
+if not settings.configured:
|
|
|
8
|
+ from oscar.defaults import *
|
|
|
9
|
+ oscar_settings = dict([(k, v) for k, v in locals().items() if k.startswith('OSCAR_')])
|
|
|
10
|
+
|
|
|
11
|
+ # Helper function to extract absolute path
|
|
|
12
|
+ location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
|
|
|
13
|
+
|
|
|
14
|
+ settings.configure(
|
|
|
15
|
+ DATABASES={
|
|
|
16
|
+ 'default': {
|
|
|
17
|
+ 'ENGINE': 'django.db.backends.sqlite3',
|
|
|
18
|
+ }
|
|
|
19
|
+ },
|
|
|
20
|
+ INSTALLED_APPS=[
|
|
|
21
|
+ 'django.contrib.auth',
|
|
|
22
|
+ 'django.contrib.admin',
|
|
|
23
|
+ 'django.contrib.contenttypes',
|
|
|
24
|
+ 'django.contrib.sessions',
|
|
|
25
|
+ 'django.contrib.sites',
|
|
|
26
|
+ # Oscar apps
|
|
|
27
|
+ 'oscar',
|
|
|
28
|
+ 'oscar.apps.analytics',
|
|
|
29
|
+ 'oscar.apps.discount',
|
|
|
30
|
+ 'oscar.apps.order',
|
|
|
31
|
+ 'oscar.apps.checkout',
|
|
|
32
|
+ 'oscar.apps.shipping',
|
|
|
33
|
+ 'oscar.apps.order_management',
|
|
|
34
|
+ 'oscar.apps.catalogue',
|
|
|
35
|
+ 'oscar.apps.catalogue.reviews',
|
|
|
36
|
+ 'oscar.apps.basket',
|
|
|
37
|
+ 'oscar.apps.payment',
|
|
|
38
|
+ 'oscar.apps.payment.datacash',
|
|
|
39
|
+ 'oscar.apps.offer',
|
|
|
40
|
+ 'oscar.apps.address',
|
|
|
41
|
+ 'oscar.apps.partner',
|
|
|
42
|
+ 'oscar.apps.customer',
|
|
|
43
|
+ 'oscar.apps.promotions',
|
|
|
44
|
+ 'oscar.apps.reports',
|
|
|
45
|
+ 'oscar.apps.search',
|
|
|
46
|
+ 'oscar.apps.voucher',
|
|
|
47
|
+ ],
|
|
|
48
|
+ TEMPLATE_CONTEXT_PROCESSORS=(
|
|
|
49
|
+ "django.contrib.auth.context_processors.auth",
|
|
|
50
|
+ "django.core.context_processors.request",
|
|
|
51
|
+ "django.core.context_processors.debug",
|
|
|
52
|
+ "django.core.context_processors.i18n",
|
|
|
53
|
+ "django.core.context_processors.media",
|
|
|
54
|
+ "django.core.context_processors.static",
|
|
|
55
|
+ "django.contrib.messages.context_processors.messages",
|
|
|
56
|
+ 'oscar.apps.search.context_processors.search_form',
|
|
|
57
|
+ 'oscar.apps.promotions.context_processors.promotions',
|
|
|
58
|
+ 'oscar.apps.checkout.context_processors.checkout',
|
|
|
59
|
+ ),
|
|
|
60
|
+ TEMPLATE_DIRS=(
|
|
|
61
|
+ location('tests/templates'),
|
|
|
62
|
+ ),
|
|
|
63
|
+ MIDDLEWARE_CLASSES=global_settings.MIDDLEWARE_CLASSES + (
|
|
|
64
|
+ 'oscar.apps.basket.middleware.BasketMiddleware',
|
|
|
65
|
+ ),
|
|
|
66
|
+ AUTHENTICATION_BACKENDS=(
|
|
|
67
|
+ 'oscar.apps.customer.auth_backends.Emailbackend',
|
|
|
68
|
+ 'django.contrib.auth.backends.ModelBackend',
|
|
|
69
|
+ ),
|
|
|
70
|
+ ROOT_URLCONF='tests.urls',
|
|
|
71
|
+ LOGIN_REDIRECT_URL='/accounts/',
|
|
|
72
|
+ DEBUG=False,
|
|
|
73
|
+ SITE_ID=1,
|
|
|
74
|
+ HAYSTACK_SEARCH_ENGINE='dummy',
|
|
|
75
|
+ HAYSTACK_SITECONF = 'oscar.search_sites',
|
|
|
76
|
+ **oscar_settings
|
|
|
77
|
+ )
|
|
|
78
|
+
|
|
|
79
|
+from django.test.simple import DjangoTestSuiteRunner
|
|
|
80
|
+
|
|
|
81
|
+
|
|
|
82
|
+def run_tests():
|
|
|
83
|
+ # Modify path
|
|
|
84
|
+ parent = os.path.dirname(os.path.abspath(__file__))
|
|
|
85
|
+ sys.path.insert(0, parent)
|
|
|
86
|
+
|
|
|
87
|
+ # Run tests
|
|
|
88
|
+ test_runner = DjangoTestSuiteRunner(verbosity=2)
|
|
|
89
|
+ failures = test_runner.run_tests(['oscar'])
|
|
|
90
|
+ sys.exit(failures)
|
|
|
91
|
+
|
|
|
92
|
+if __name__ == '__main__':
|
|
|
93
|
+ run_tests()
|