bitbake: toastergui: Add frontend javascript unit tests

Use Jquery's Qunit tests to create some unit tests for javascript
components used in toaster.

(Bitbake rev: 1c2f6b9b7b9e700146944b9d6d2114e0d014ee81)

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>
This commit is contained in:
Michael Wood 2015-08-17 17:47:47 +01:00 committed by Richard Purdie
parent ab9644f7ac
commit 14d44456ad
2 changed files with 19 additions and 0 deletions

View File

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

View File

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