Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
962517cf
authored
Nov 03, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: test templates
parent
72e1a7ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
circle/dashboard/tests/test_templates.py
+52
-0
No files found.
circle/dashboard/tests/test_templates.py
0 → 100644
View file @
962517cf
# Copyright 2014 Budapest University of Technology and Economics (BME IK)
#
# This file is part of CIRCLE Cloud.
#
# CIRCLE is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# CIRCLE is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along
# with CIRCLE. If not, see <http://www.gnu.org/licenses/>.
from
os
import
listdir
from
os.path
import
isfile
,
isdir
,
join
import
unittest
from
django.conf
import
settings
from
django.template
import
Template
,
Context
,
VariableDoesNotExist
from
django.template.loader
import
find_template_loader
from
django.core.urlresolvers
import
NoReverseMatch
class
SubscribeTestCase
(
unittest
.
TestCase
):
def
test_templates
(
self
):
"""Test all templates for syntax errors."""
for
loader_name
in
settings
.
TEMPLATE_LOADERS
:
print
loader_name
loader
=
find_template_loader
(
loader_name
)
self
.
_test_dir
(
loader
.
get_template_sources
(
''
))
def
_test_dir
(
self
,
dir
,
path
=
"/"
):
for
i
in
dir
:
i
=
join
(
path
,
i
)
if
isfile
(
i
):
self
.
_test_template
(
join
(
path
,
i
))
elif
isdir
(
i
):
print
"
%
s:"
%
i
self
.
_test_dir
(
listdir
(
i
),
i
)
def
_test_template
(
self
,
path
):
print
path
try
:
Template
(
open
(
path
)
.
read
())
.
render
(
Context
({}))
except
(
NoReverseMatch
,
VariableDoesNotExist
,
KeyError
,
AttributeError
,
ValueError
,
)
as
e
:
print
e
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment