forked from kirberich/djangae
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_settings.py
100 lines (81 loc) · 2.39 KB
/
test_settings.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
import os
from django.urls import (
include,
path,
)
BASE_DIR = os.path.dirname(__file__)
STATIC_URL = "/static/"
TEST_RUNNER = "djangae.test.AppEngineDiscoverRunner"
# Set the cache during tests to local memory, which is threadsafe
# then our TestCase clears the cache in setUp()
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'unique-snowflake',
}
}
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'APP_DIRS': True,
},
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'djangae.contrib.common.middleware.RequestStorageMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'djangae.contrib.googleauth.middleware.AuthenticationMiddleware',
'djangae.tasks.middleware.task_environment_middleware',
]
INSTALLED_APPS = (
'djangae',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.auth',
'djangae.contrib.googleauth',
'gcloudc',
'djangae.tasks',
'djangae.contrib.search',
)
AUTHENTICATION_BACKENDS = [
'djangae.contrib.googleauth.backends.iap.IAPBackend',
'djangae.contrib.googleauth.backends.oauth2.OAuthBackend',
]
AUTH_USER_MODEL = "googleauth.User"
GOOGLEAUTH_CLIENT_ID = "test"
GOOGLEAUTH_CLIENT_SECRET = "test"
DATABASES = {
'default': {
'ENGINE': 'gcloudc.db.backends.datastore',
'INDEXES_FILE': os.path.join(os.path.abspath(os.path.dirname(__file__)), "djangaeidx.yaml"),
"PROJECT": "test",
"NAMESPACE": "ns1", # Use a non-default namespace to catch edge cases where we forget
"OPTIONS": {
"BULK_BATCH_SIZE": 25
}
}
}
SECRET_KEY = "secret_key_for_testing"
USE_TZ = True
CSRF_USE_SESSIONS = True
CLOUD_TASKS_LOCATION = "[LOCATION]"
# Define two required task queues
CLOUD_TASKS_QUEUES = [
{
"name": "default"
},
{
"name": "another"
}
]
# Point the URL conf at this file
ROOT_URLCONF = __name__
urlpatterns = [
path('tasks/', include('djangae.tasks.urls')),
path('_ah/', include('djangae.urls')),
]
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = '1'