]> git.ozlabs.org Git - patchwork/blob - apps/patchwork/tests/list.py
templates: Don't rely on bool(Page)
[patchwork] / apps / patchwork / tests / list.py
1 # Patchwork - automated patch tracking system
2 # Copyright (C) 2012 Jeremy Kerr <jk@ozlabs.org>
3 #
4 # This file is part of the Patchwork package.
5 #
6 # Patchwork is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
10 #
11 # Patchwork is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Patchwork; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20 import unittest
21 from django.test import TestCase
22 from django.test.client import Client
23 from patchwork.tests.utils import defaults, create_user, find_in_context
24 from django.core.urlresolvers import reverse
25
26 class EmptyPatchListTest(TestCase):
27
28     def testEmptyPatchList(self):
29         """test that we don't output an empty table when there are no
30            patches present"""
31         project = defaults.project
32         defaults.project.save()
33         url = reverse('patchwork.views.patch.list',
34                 kwargs={'project_id': project.linkname})
35         response = self.client.get(url)
36         self.assertContains(response, 'No patches to display')
37         self.assertNotContains(response, 'tbody')
38