forked from spookylukey/django-paypal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathruntests.py
executable file
·108 lines (93 loc) · 3.52 KB
/
runtests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env python
from __future__ import unicode_literals
import argparse
import sys
import warnings
import django
from django.conf import settings
from django.core.management import execute_from_command_line
warnings.simplefilter("always", PendingDeprecationWarning)
warnings.simplefilter("always", DeprecationWarning)
parser = argparse.ArgumentParser(description="Run the test suite, or specific tests specified using dotted paths.")
parser.add_argument("--use-tz-false", action='store_true', default=False,
help="Set USE_TZ=False in settings")
known_args, remaining_args = parser.parse_known_args()
remaining_options = [a for a in remaining_args if a.startswith('-')]
test_args = [a for a in remaining_args if not a.startswith('-')]
settings_dict = dict(
ROOT_URLCONF='',
DATABASES={'default': {'ENGINE': 'django.db.backends.sqlite3'}},
PAYPAL_TEST=True,
# Please dont make me create another test account and remove this from here :)
PAYPAL_WPP_USER='django.paypal.seller_api1.gmail.com',
PAYPAL_WPP_PASSWORD='D5LBCTEKUUJR8EKL',
PAYPAL_WPP_SIGNATURE='AFcWxV21C7fd0v3bYYYRCpSSRl31A6nHqN3IBok0TF-H8I-C8C6u41Do',
PAYPAL_IDENTITY_TOKEN='xxx',
INSTALLED_APPS=[
'django.contrib.auth',
'django.contrib.admin',
'django.contrib.sessions',
'django.contrib.contenttypes',
'paypal.pro',
'paypal.standard',
'paypal.standard.ipn',
'paypal.standard.pdt',
],
CACHES={
'default': {
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',
'TIMEOUT': 0,
'KEY_PREFIX': 'paypal_tests_',
}
},
MIDDLEWARE=[
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
],
TEMPLATES=[ # Django 1.8 and later
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
],
},
},
],
USE_TZ=not known_args.use_tz_false,
LOGGING={
'version': 1,
'disable_existing_loggers': True,
'root': {
'level': 'WARNING',
'handlers': ['console'],
},
'handlers': {
'console': {
'level': 'WARNING',
'class': 'logging.StreamHandler',
},
},
},
)
if django.VERSION < (1, 10):
settings_dict['MIDDLEWARE_CLASSES'] = settings_dict.pop('MIDDLEWARE')
settings.configure(**settings_dict)
if len(test_args) == 0:
test_args = ["paypal.pro.tests", "paypal.standard.ipn.tests", "paypal.standard.pdt.tests"]
argv = [sys.argv[0], "test"] + remaining_options + test_args
if __name__ == '__main__':
execute_from_command_line(argv)