aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Wood <michael.g.wood@intel.com>2015-08-17 17:47:47 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-29 14:03:26 +0100
commit1c2f6b9b7b9e700146944b9d6d2114e0d014ee81 (patch)
treeff32aebc478d5bd6b8da13cb48c1a1c91c03a288
parent120816b133b9c160c68c911a9f4c612ce2f8a9ed (diff)
downloadbitbake-1c2f6b9b7b9e700146944b9d6d2114e0d014ee81.tar.gz
toastergui: Add frontend javascript unit tests
Use Jquery's Qunit tests to create some unit tests for javascript components used in toaster. Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: brian avery <avery.brian@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/toaster/toastergui/urls.py3
-rwxr-xr-xlib/toaster/toastergui/views.py16
2 files changed, 19 insertions, 0 deletions
diff --git a/lib/toaster/toastergui/urls.py b/lib/toaster/toastergui/urls.py
index f74090b9b..46e576144 100644
--- a/lib/toaster/toastergui/urls.py
+++ b/lib/toaster/toastergui/urls.py
@@ -145,6 +145,9 @@ urlpatterns = patterns('toastergui.views',
url(r'^xhr_importlayer/$', 'xhr_importlayer', name='xhr_importlayer'),
url(r'^xhr_updatelayer/$', 'xhr_updatelayer', name='xhr_updatelayer'),
+ # JS Unit tests
+ url(r'^js-unit-tests/$', 'jsunittests', name='js-unit-tests'),
+
# default redirection
url(r'^$', RedirectView.as_view( url= 'landing')),
)
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index c8ff693ae..c583d9613 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -31,6 +31,7 @@ from django.shortcuts import render, redirect
from orm.models import Build, Target, Task, Layer, Layer_Version, Recipe, LogMessage, Variable
from orm.models import Task_Dependency, Recipe_Dependency, Package, Package_File, Package_Dependency
from orm.models import Target_Installed_Package, Target_File, Target_Image_File, BuildArtifact
+from orm.models import BitbakeVersion
from bldcontrol import bbcontroller
from django.views.decorators.cache import cache_control
from django.core.urlresolvers import reverse, resolve
@@ -2260,6 +2261,21 @@ if True:
return context
+ def jsunittests(request):
+ """ Provides a page for the js unit tests """
+ bbv = BitbakeVersion.objects.filter(branch="master").first()
+ release = Release.objects.filter(bitbake_version=bbv).first()
+
+ name = "_js_unit_test_prj_"
+
+ # If there is an existing project by this name delete it. We don't want
+ # Lots of duplicates cluttering up the projects.
+ Project.objects.filter(name=name).delete()
+
+ new_project = Project.objects.create_project(name=name, release=release)
+
+ context = { 'project' : new_project }
+ return render(request, "js-unit-tests.html", context)
from django.views.decorators.csrf import csrf_exempt
@csrf_exempt