forked from zueve/django-rest-captcha
-
Notifications
You must be signed in to change notification settings - Fork 1
/
runtests.py
46 lines (42 loc) · 1.13 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
import sys
import os
from django.conf import settings
from django.core.management import call_command
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
settings.configure(
INSTALLED_APPS=(
"django.contrib.auth",
"django.contrib.contenttypes",
"rest_framework",
"rest_captcha",
),
DATABASES={
"default": {
"ENGINE": "django.db.backends.sqlite3",
"NAME": ":MEMORY:",
}
},
CACHES={
"default": {
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "rest-captcha",
"MAX_ENTRIES": 10000,
}
},
REST_FRAMEWORK={
"DEFAULT_AUTHENTICATION_CLASSES": [
"rest_framework.authentication.BasicAuthentication"
],
"DEFAULT_PERMISSION_CLASSES": ["rest_framework.permissions.AllowAny"],
},
ROOT_URLCONF="rest_captcha.urls",
MIDDLEWARE_CLASSES=(),
)
def main():
try:
from django.apps import apps
except ImportError:
pass
else:
apps.populate(settings.INSTALLED_APPS)
call_command("test", "rest_captcha")