gva/gnuviechadmin/userdbs/tests/templatetags/test_userdb.py
Jan Dittberner 1649e4592e Add tests for userdbs app
This commit adds a set of unit tests for the userdbs app. Some tests
will fail because a refactoring to signals comes with the next commit.
2015-12-07 00:22:13 +00:00

46 lines
1.2 KiB
Python

"""
This module provides tests for the functions in
:py:mod:`userdbs.templatetags.userdb`.
"""
from __future__ import unicode_literals
from unittest import TestCase
from django.utils.translation import gettext as _
from userdbs.models import DB_TYPES
from userdbs.templatetags.userdb import db_type_icon_class, db_type_name
class UserdbTemplateTagTests(TestCase):
"""
Test suite for :py:mod:`userdbs.templatetags.userdb` functions.
"""
def test_db_type_icon_class_unknown(self):
self.assertEqual(
db_type_icon_class({'db_type': 'unknown'}),
'icon-database')
def test_db_type_icon_class_mysql(self):
self.assertEqual(
db_type_icon_class({'db_type': DB_TYPES.mysql}),
'icon-mysql')
def test_db_type_icon_class_pgsql(self):
self.assertEqual(
db_type_icon_class({'db_type': DB_TYPES.pgsql}),
'icon-postgres')
def test_db_type_name_mysql(self):
self.assertEqual(
db_type_name({'db_type': DB_TYPES.mysql}),
_(DB_TYPES[DB_TYPES.mysql]))
def test_db_type_name_pgsql(self):
self.assertEqual(
db_type_name({'db_type': DB_TYPES.pgsql}),
_(DB_TYPES[DB_TYPES.pgsql]))