summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastergui/tests.py
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-08-10 18:27:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-10 13:58:01 -0700
commitb3ab9b1211a49712bc703bbe018ad125fa9d8418 (patch)
treee15a4c94401714892d138bfff092ba859c4cf9db /bitbake/lib/toaster/toastergui/tests.py
parent8ee14d59ed27498cf92f1b6527d3c0379245bd57 (diff)
downloadpoky-b3ab9b1211a49712bc703bbe018ad125fa9d8418.tar.gz
bitbake: toaster: add header and docstings
Added header and docstrings to toastergui tests module. (Bitbake rev: d46bc24e95fa27cee686b84fbd8c6407efa2635b) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastergui/tests.py')
-rw-r--r--bitbake/lib/toaster/toastergui/tests.py29
1 files changed, 28 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastergui/tests.py b/bitbake/lib/toaster/toastergui/tests.py
index 624ab7cad9..1ed83dceda 100644
--- a/bitbake/lib/toaster/toastergui/tests.py
+++ b/bitbake/lib/toaster/toastergui/tests.py
@@ -1,3 +1,26 @@
1#! /usr/bin/env python
2# ex:ts=4:sw=4:sts=4:et
3# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
4#
5# BitBake Toaster Implementation
6#
7# Copyright (C) 2013-2015 Intel Corporation
8#
9# This program is free software; you can redistribute it and/or modify
10# it under the terms of the GNU General Public License version 2 as
11# published by the Free Software Foundation.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License along
19# with this program; if not, write to the Free Software Foundation, Inc.,
20# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21
22"""Test cases for Toaster GUI and ReST."""
23
1from django.test import TestCase 24from django.test import TestCase
2from django.core.urlresolvers import reverse 25from django.core.urlresolvers import reverse
3from orm.models import Project, Release, BitbakeVersion 26from orm.models import Project, Release, BitbakeVersion
@@ -45,6 +68,7 @@ class ViewTests(TestCase):
45 self.assertTrue(self.lver in self.project.compatible_layerversions()) 68 self.assertTrue(self.lver in self.project.compatible_layerversions())
46 69
47 def test_get_base_call_returns_html(self): 70 def test_get_base_call_returns_html(self):
71 """Basic test for all-projects view"""
48 response = self.client.get(reverse('all-projects'), follow=True) 72 response = self.client.get(reverse('all-projects'), follow=True)
49 self.assertEqual(response.status_code, 200) 73 self.assertEqual(response.status_code, 200)
50 self.assertTrue(response['Content-Type'].startswith('text/html')) 74 self.assertTrue(response['Content-Type'].startswith('text/html'))
@@ -52,6 +76,7 @@ class ViewTests(TestCase):
52 self.assertTrue(PROJECT_NAME in response.content) 76 self.assertTrue(PROJECT_NAME in response.content)
53 77
54 def test_get_json_call_returns_json(self): 78 def test_get_json_call_returns_json(self):
79 """Test for all projects output in json format"""
55 url = reverse('all-projects') 80 url = reverse('all-projects')
56 response = self.client.get(url, {"format": "json"}, follow=True) 81 response = self.client.get(url, {"format": "json"}, follow=True)
57 self.assertEqual(response.status_code, 200) 82 self.assertEqual(response.status_code, 200)
@@ -73,6 +98,7 @@ class ViewTests(TestCase):
73 self.assertTrue("projectBuildsUrl" in data["rows"][0]) 98 self.assertTrue("projectBuildsUrl" in data["rows"][0])
74 99
75 def test_typeaheads(self): 100 def test_typeaheads(self):
101 """Test typeahead ReST API"""
76 layers_url = reverse('xhr_layerstypeahead', args=(self.project.id,)) 102 layers_url = reverse('xhr_layerstypeahead', args=(self.project.id,))
77 prj_url = reverse('xhr_projectstypeahead') 103 prj_url = reverse('xhr_projectstypeahead')
78 104
@@ -82,7 +108,8 @@ class ViewTests(TestCase):
82 reverse('xhr_machinestypeahead', args=(self.project.id,)), 108 reverse('xhr_machinestypeahead', args=(self.project.id,)),
83 ] 109 ]
84 110
85 def basic_reponse_check(reponse, url): 111 def basic_reponse_check(response, url):
112 """Check data structure of http response."""
86 self.assertEqual(response.status_code, 200) 113 self.assertEqual(response.status_code, 200)
87 self.assertTrue(response['Content-Type'].startswith('application/json')) 114 self.assertTrue(response['Content-Type'].startswith('application/json'))
88 115