Add to context processor and menu test cases

- Minor style updates to other tests
This commit is contained in:
Sunil Mohan Adapa committed 2015-01-30 18:11:37 +05:30
1 parent f184c23c31
commit e69b500247
3 files changed
+58 -34

No files matched your search

+16 -1
View File
@@ -1,5 +1,4 @@
#!/usr/bin/python3
# -*- mode: python; mode: auto-fill; fill-column: 80 -*-
#
# This file is part of Plinth.
#
@@ -15,6 +14,7 @@
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
from django.http import HttpRequest
import unittest
@@ -44,6 +44,21 @@ class ContextProcessorsTestCase(unittest.TestCase):
self.assertIsNotNone(urls)
self.assertEqual(['/', '/aaa/', '/aaa/bbb/', '/aaa/bbb/ccc/'], urls)
def test_common_border_conditions(self):
"""Verify that the 'common' functions works for border conditions."""
request = HttpRequest()
request.path = ''
response = cp.common(request)
self.assertEqual([], response['active_menu_urls'])
request.path = '/'
response = cp.common(request)
self.assertEqual(['/'], response['active_menu_urls'])
request.path = '/aaa/bbb'
response = cp.common(request)
self.assertEqual(['/', '/aaa/'], response['active_menu_urls'])
if __name__ == '__main__':
unittest.main()