summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRadomir Dopieralski <openstack@sheep.art.pl>2013-10-07 09:31:30 +0200
committerRadomir Dopieralski <openstack@sheep.art.pl>2013-10-08 15:14:22 +0200
commit5699b654511872080bacab31b8d5e4b50d350889 (patch)
treed937360ac5e89a3a4952d38c3cbd94ea95d30a7f
parenta2b44821cffcb734ad5be4d6144a86f80eb5bc11 (diff)
downloadtuskar-ui-5699b654511872080bacab31b8d5e4b50d350889.tar.gz
Add infrastructure for running unit tests
Add a view that runs the Tuskar-UI-specific JavaScript QUinit tests. No tests at this point. Change-Id: I0a3ceb3a21c41a3c1ff942e9a4c8a6c9176cf910
-rw-r--r--tuskar_ui/infrastructure/resource_management/urls.py8
-rw-r--r--tuskar_ui/infrastructure/templates/infrastructure/qunit.html27
-rw-r--r--tuskar_ui/test/urls.py21
3 files changed, 56 insertions, 0 deletions
diff --git a/tuskar_ui/infrastructure/resource_management/urls.py b/tuskar_ui/infrastructure/resource_management/urls.py
index 03d2ce87..17ce65e0 100644
--- a/tuskar_ui/infrastructure/resource_management/urls.py
+++ b/tuskar_ui/infrastructure/resource_management/urls.py
@@ -12,6 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
+from django import conf
from django.conf.urls import defaults
from tuskar_ui.infrastructure.resource_management.nodes\
@@ -21,6 +22,8 @@ from tuskar_ui.infrastructure.resource_management.racks\
from tuskar_ui.infrastructure.resource_management.resource_classes\
import urls as resource_classes_urls
from tuskar_ui.infrastructure.resource_management import views
+from tuskar_ui.test import urls as test_urls
+
urlpatterns = defaults.patterns('',
defaults.url(r'^$', views.IndexView.as_view(), name='index'),
@@ -34,3 +37,8 @@ urlpatterns = defaults.patterns('',
namespace='resource_classes')),
defaults.url(r'^nodes/', defaults.include(node_urls, namespace='nodes')),
)
+
+if conf.settings.DEBUG:
+ urlpatterns += defaults.patterns('',
+ defaults.url(r'^qunit$', defaults.include(test_urls, namespace='tests'))
+ )
diff --git a/tuskar_ui/infrastructure/templates/infrastructure/qunit.html b/tuskar_ui/infrastructure/templates/infrastructure/qunit.html
new file mode 100644
index 00000000..ad03ae99
--- /dev/null
+++ b/tuskar_ui/infrastructure/templates/infrastructure/qunit.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="UTF-8" />
+ <title>Tuskar QUnit Test Suite</title>
+ <link rel="stylesheet" href="{{ STATIC_URL }}horizon/lib/qunit/qunit.css" type="text/css" media="screen">
+ <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/jquery/jquery.min.js"></script>
+ <script type="text/javascript" src="{{ STATIC_URL }}horizon/lib/qunit/qunit.js"></script>
+ {% include "horizon/_conf.html" %}
+
+ {% comment %}Load test modules here.{% endcomment %}
+ {% comment %}End test modules.{% endcomment %}
+
+ {% include "horizon/_scripts.html" %}
+ {% include "infrastructure/_scripts.html" %}
+ </head>
+ <body>
+ <h1 id="qunit-header">Tuskar JavaScript Tests</h1>
+ <h2 id="qunit-banner"></h2>
+ <div id="qunit-testrunner-toolbar"></div>
+ <h2 id="qunit-userAgent"></h2>
+ <ol id="qunit-tests"></ol>
+ <div id="qunit-fixture">
+ <!-- Test markup; will be hidden. -->
+ </div>
+ </body>
+</html>
diff --git a/tuskar_ui/test/urls.py b/tuskar_ui/test/urls.py
new file mode 100644
index 00000000..a68c63f0
--- /dev/null
+++ b/tuskar_ui/test/urls.py
@@ -0,0 +1,21 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from django.conf.urls import defaults
+from django.views import generic
+
+
+urlpatterns = defaults.patterns('', defaults.url(r'^$',
+ generic.TemplateView.as_view(template_name="infrastructure/qunit.html"),
+ name='qunit_tests'))