Skip to content

Commit d125fa6

Browse files
committed
added start of tests
1 parent d6420c8 commit d125fa6

File tree

5 files changed

+198
-0
lines changed

5 files changed

+198
-0
lines changed

run_tests.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from tests.setup_app import main
2+
3+
main()

tests/__init__.py

Whitespace-only changes.

tests/setup_app.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from flask_xxl.main import AppFactory
2+
from test_settings import BaseConfig
3+
4+
def main():
5+
app = AppFactory(BaseConfig).get_app(__name__)
6+
7+
if __name__ == "__main__":
8+
main()

tests/test_local_settings.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class LocalConfig(object):
2+
SECRET_KEY = 'secret'
3+
4+
DATABASE_URI = 'sqlite:///xxx'
5+
6+
VERBOSE = True

tests/test_settings.py

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
settings
5+
~~~~~~~~
6+
7+
Global settings for project.
8+
"""
9+
import os
10+
from .test_local_settings import LocalConfig
11+
12+
class BaseConfig(LocalConfig):
13+
SYSTEM_MESSAGE_CATEGORIES = [
14+
'success' # 0 - GREEN
15+
'info', # 1 - BLUE
16+
'warning', # 2 - YELLOW
17+
'danger', # 3 - RED
18+
]
19+
20+
ADMIN_PER_PAGE = 5
21+
CODEMIRROR_LANGUAGES = ['python','python2','python3','php','javascript','xml','jinja2']
22+
CODEMIRROR_THEME = 'blackboard'#'vivid-chalk'#'3024-night'
23+
SQLALCHEMY_ECHO = True
24+
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
25+
CSRF_ENABLED = True
26+
ROOT_PATH = os.path.abspath(os.path.dirname(__file__))
27+
28+
URL_MODULES = [
29+
#'core.urls.routes',
30+
#'admin.urls.routes',
31+
'flask.ext.xxl.apps.auth.urls.routes',
32+
'flask.ext.xxl.apps.page.urls.routes',
33+
'flask.ext.xxl.apps.admin.urls.routes',
34+
#'blog.urls.routes',
35+
#'member.urls.routes',
36+
#'page.urls.routes',
37+
#'fileviewer.urls.routes',
38+
]
39+
40+
BLUEPRINTS = [
41+
#'core.core',
42+
#'member.member',
43+
#'admin.admin',
44+
#'menu.menu',
45+
#'blog.blog',
46+
#'page.page',
47+
'flask.ext.xxl.apps.auth.auth',
48+
'flask.ext.xxl.page.auth.auth',
49+
'flask.ext.xxl.admin.auth.auth',
50+
#'auth.auth',
51+
#'fileviewer.fileviewer',
52+
53+
]
54+
55+
EXTENSIONS = [
56+
#'ext.db',
57+
#'ext.toolbar',
58+
#'ext.pagedown',
59+
#'ext.codemirror',
60+
#'ext.alembic',
61+
]
62+
63+
CONTEXT_PROCESSORS = [
64+
#'core.context_processors.common_context',
65+
#'core.context_processors.common_forms',
66+
#'menu.context_processors.frontend_nav',
67+
#'menu.context_processors.admin_nav',
68+
#'auth.context_processors.user_context',
69+
#'core.context_processors.add_is_page',
70+
#'core.context_processors.add_is_list',
71+
#'core.context_processors.add_get_model',
72+
#'core.context_processors.add_get_button',
73+
#'core.context_processors.add_get_icon',
74+
#'core.context_processors.get_context',
75+
#'core.context_processors.add_get_block',
76+
#'core.context_processors.add_urlfor',
77+
#'core.context_processors.add_layouts',
78+
#'core.context_processors.add_layout_mode',
79+
#'page.context_processors.add_page_self_context',
80+
#'menu.context_processors.get_navbar',
81+
#'menu.context_processors._add_navbar',
82+
#'menu.context_processors.sidebar',
83+
#'make_base.base',
84+
#'auth.context_processors.auth_context',
85+
#'blog.context_processors.add_admin_head',
86+
#'core.context_processors.add_size_converters',
87+
88+
]
89+
90+
TEMPLATE_FILTERS = [
91+
'flask.ext.xxl.filters.date',
92+
'flask.ext.xxl.filters.date_pretty',
93+
'flask.ext.xxl.filters.datetime',
94+
'flask.ext.xxl.filters.pluralize',
95+
'flask.ext.xxl.filters.month_name',
96+
'flask.ext.xxl.filters.markdown',
97+
#'core.context_processors.fix_body',
98+
#'core.filters.split',
99+
#'blog.filters.markdown',
100+
]
101+
102+
CONTACT_FORM_SETTINGS = {
103+
'HEADING':'Send Us a message',
104+
'SUBHEADING':'Or a Comment',
105+
'OPTIONS':(
106+
('test','opt1'),
107+
('test2','opt2'),
108+
('test3','opt3'),
109+
('test4','opt4'),
110+
('test5','opt5'),
111+
('test6','opt6'),
112+
),
113+
'SUBMIT_TEXT':'Send to Us',
114+
'COMPANY_TITLE':'Level2designs',
115+
'COMPANY_ADDRESS':{
116+
'NAME':'level2designs',
117+
'STREET':'1045 w katella',
118+
'CITY':'Orange',
119+
'STATE':'CA',
120+
'ZIP':'92804',
121+
},
122+
'COMPANY_PHONE':'714-783-6369',
123+
'CONTACT_NAME':'Roux',
124+
'CONTACT_EMAIL':'[email protected]',
125+
}
126+
127+
128+
# populates header option in creating a cms page
129+
# should be tuples of (name,file)
130+
NAVBAR_TEMPLATE_FILES = (
131+
('bootstrap-std','navbars/bs_std.html'),
132+
('bootstrap-inverse','navbars/bs_inverse.html'),
133+
('blog','navbars/blog.html'),
134+
('clean','navbars/clean.html')
135+
)
136+
137+
DEFAULT_NAVBAR = 'clean'
138+
139+
LAYOUT_FILES = {
140+
'blog':'layouts/1col_leftsidebar.html',
141+
'post_form':'layouts/1col_rightsidebar.html',
142+
'one_col_left':'layouts/1col_leftsidebar.html',
143+
'one_col_right':'layouts/1col_rightsidebar.html',
144+
'two_col_left':'layouts/2col_leftsidebar.html',
145+
'two_col_right':'layouts/2col_rightsidebar.html',
146+
'three_col_left':'layouts/3col_leftsidebar.html',
147+
148+
}
149+
150+
BASE_TEMPLATE_FILES = [
151+
('one_col_left','1_col_left.html'),
152+
('one_col_right','1_col_right.html'),
153+
('two_col_left','2_col_left.html'),
154+
('two_col_right','2_col_right.html'),
155+
('three_col','3_col.html'),
156+
]
157+
158+
#BLOG_SIDEBAR_LEFT = False
159+
#BLOG_SIDEBAR_RIGHT = True
160+
BLOG_SIDEBAR_LEFT = True
161+
#BLOG_SIDEBAR_RIGHT = False
162+
BLOG_TITLE = 'Dynamic'
163+
BLOG_CONTENT = 'some text to put into my<br />Blog'
164+
165+
DEFAULT_ICON_LIBRARY = 'octicon'
166+
167+
def get_choices():
168+
return BaseConfig.CONTACT_FORM_SETTINGS['OPTIONS']
169+
170+
171+
class DevelopmentConfig(BaseConfig):
172+
DEBUG = True
173+
DEBUG_TB_PROFILER_ENABLED = True
174+
DEBUG_TB_INTERCEPT_REDIRECTS = False
175+
176+
177+
class TestingConfig(BaseConfig):
178+
TESTING = True
179+
SQLALCHEMY_ECHO = False
180+
SQLALCHEMY_DATABASE_URI = 'mysql://test:[email protected]:3306/test_test5'
181+

0 commit comments

Comments
 (0)