[Toaster] [PATCH 8/9] toaster: add header and docsting
Ed Bartosh
ed.bartosh at linux.intel.com
Thu Aug 6 03:15:14 PDT 2015
Added header and docstrings to toastergui tests module.
Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
bitbake/lib/toaster/toastergui/tests.py | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index a6b5c9b..a549a02 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -1,3 +1,26 @@
+#! /usr/bin/env python
+# ex:ts=4:sw=4:sts=4:et
+# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
+#
+# BitBake Toaster Implementation
+#
+# Copyright (C) 2013-2015 Intel Corporation
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+"""Test cases for Toaster GUI and ReST."""
+
from django.test import TestCase
from django.core.urlresolvers import reverse
from orm.models import Project, Release, BitbakeVersion
@@ -7,6 +30,8 @@ from orm.models import Layer, Layer_Version
PROJECT_NAME = "test project"
class ViewTests(TestCase):
+ """Tests to verify view APIs."""
+
def setUp(self):
self.bbv = BitbakeVersion.objects.create(\
name="test bbv", giturl="/tmp/",
@@ -30,6 +55,7 @@ class ViewTests(TestCase):
self.assertTrue(self.lver in self.project.compatible_layerversions())
def test_get_base_call_returns_html(self):
+ """Basic test for all-projects view."""
response = self.client.get(reverse('all-projects'), follow=True)
self.assertEqual(response.status_code, 200)
self.assertTrue(response['Content-Type'].startswith('text/html'))
@@ -37,6 +63,7 @@ class ViewTests(TestCase):
self.assertTrue(PROJECT_NAME in response.content)
def test_get_json_call_returns_json(self):
+ """Test for all projects output in json format."""
url = reverse('all-projects')
response = self.client.get(url, {"format": "json"}, follow=True)
self.assertEqual(response.status_code, 200)
@@ -59,6 +86,7 @@ class ViewTests(TestCase):
self.assertTrue("projectBuildsUrl" in data["rows"][0])
def test_xhr_datatypeahead_layer(self):
+ """Test ReST API xhr_datatypeahead."""
url = reverse('xhr_datatypeahead', args=(self.project.id,))
response = self.client.get(url, {"type": "versionlayers"})
self.assertEqual(response.status_code, 200)
--
2.1.4
More information about the toaster
mailing list