Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made view logic re-usable so that a custom render method can be swapp…

…ed out
  • Loading branch information...
commit dfe694e2510a4d7679a97857a480ec5cc119fd63 1 parent dc68031
@kumar303 kumar303 authored committed
Showing with 7 additions and 3 deletions.
  1. +7 −3 django_qunit/views.py
View
10 django_qunit/views.py
@@ -4,7 +4,7 @@
import os
-def run_tests(request, path):
+def get_suite_context(request, path):
full_path = os.path.join(settings.QUNIT_TEST_DIRECTORY, path)
full_path, directories, files = os.walk(full_path).next()
@@ -29,13 +29,17 @@ def run_tests(request, path):
previous_directory = parent_directory(path)
- return render_to_response('qunit/index.html', {
+ return {
'files': [path + file for file in files if file.endswith('js')],
'previous_directory': previous_directory,
'in_subdirectory': True and (previous_directory is not None) or False,
'subsuites': directories,
'suite': suite,
- })
+ }
+
+def run_tests(request, path):
+ suite_context = get_suite_context(request, path)
+ return render_to_response('qunit/index.html', suite_context)
def parent_directory(path):
"""
Please sign in to comment.
Something went wrong with that request. Please try again.