forked from django-cms/django-cms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestserver.py
115 lines (104 loc) · 2.91 KB
/
testserver.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
109
110
111
112
113
114
115
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import sys
def noop_gettext(s):
return s
permission = True
cms_toolbar_edit_on = 'edit'
if '--CMS_PERMISSION=False' in sys.argv:
permission = False
if '--CMS_TOOLBAR_URL__EDIT_ON=test-edit' in sys.argv:
cms_toolbar_edit_on = 'test-edit'
gettext = noop_gettext
HELPER_SETTINGS = dict(
CMS_PERMISSION=permission,
LANGUAGES=(
('en', u'English'),
('de', u'Deutsch'),
('it', u'Italiano'),
('zh-cn', u'Chinese (Simplified)'),
),
LANGUAGE_CODE='en',
PARLER_LANGUAGES={
1: (
{'code': 'en', 'fallbacks': ['de',]},
{'code': 'de', 'fallbacks': ['en',]},
{'code': 'it', 'fallbacks': ['en',]},
{'code': 'zh-cn', 'fallbacks': ['en',]},
),
'default': {
'fallback': 'en',
'hide_untranslated': False,
},
},
PARLER_ENABLE_CACHING=False,
CMS_CACHE_DURATIONS={
'menus': 0,
'content': 0,
'permissions': 0,
},
CMS_TOOLBAR_URL__EDIT_ON=cms_toolbar_edit_on,
# required for integration tests
LOGIN_URL='/admin/login/?user-login=test',
CMS_LANGUAGES={
1: [
{
'code': 'en',
'name': gettext('English'),
'fallbacks': ['de',],
},
{
'code': 'de',
'name': gettext('German'),
'fallbacks': ['en',],
},
{
'code': 'it',
'name': gettext('Italian'),
'fallbacks': ['en',],
},
{
'code': 'zh-cn',
'name': gettext('Chinese Simplified'),
'fallbacks': ['en',]
},
],
'default': {
'fallbacks': ['en', 'de',],
'redirect_on_fallback': False,
'public': True,
'hide_untranslated': False,
}
},
INSTALLED_APPS=[
'reversion',
'djangocms_text_ckeditor',
'djangocms_grid',
'filer',
'aldryn_bootstrap3',
'cms.test_utils.project.placeholderapp',
],
MIDDLEWARE_CLASSES=[
'cms.middleware.utils.ApphookReloadMiddleware',
],
TEMPLATE_DIRS=(
os.path.join(
os.path.dirname(__file__),
'cms', 'test_utils', 'project', 'templates', 'integration'),
),
CMS_TEMPLATES=(
('fullwidth.html', 'Fullwidth'),
('page.html', 'Standard page'),
('simple.html', 'Simple page'),
),
)
def run():
from djangocms_helper import runner
os.environ.setdefault('DATABASE_URL', 'sqlite://localhost/testdb.sqlite')
# we use '.runner()', not '.cms()' nor '.run()' because it does not
# add 'test' argument implicitly
runner.runner([sys.argv[0], 'cms', '--cms', 'server'])
if __name__ == "__main__":
run()