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
This commit is contained in:
Radomir Dopieralski 2013-10-07 09:31:30 +02:00
parent a2b44821cf
commit 5699b65451
3 changed files with 56 additions and 0 deletions

View File

@ -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'))
)

View File

@ -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>

21
tuskar_ui/test/urls.py Normal file
View File

@ -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'))