Skip to content

Commit

Permalink
Add another tags test
Browse files Browse the repository at this point in the history
  • Loading branch information
SmileyChris committed Jul 21, 2015
1 parent 531609c commit dfa9f35
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions django_countries/tests/test_tags.py
Expand Up @@ -5,14 +5,21 @@

class TestCountriesTags(TestCase):

TEMPLATE_COUNTRY = Template("{% load countries %}{% get_country code as country %}{{ country }}")
TEMPLATE_NAME = Template("{% load countries %}{% get_country code as country %}{{ country.name }}")
TEMPLATE_COUNTRY = Template(
"{% load countries %}{% get_country code as country %}{{ country }}")
TEMPLATE_NAME = Template(
"{% load countries %}{% get_country code as country %}"
"{{ country.name }}")

def test_country(self):
rendered = self.TEMPLATE_COUNTRY.render(Context({'code': 'BR'}))
self.assertEqual(rendered, 'BR')

def test_country_name(self):
rendered = self.TEMPLATE_NAME.render(Context({'code': 'BR'}))
self.assertEqual(rendered, 'Brazil')

def test_country_name_translated(self):
with translation.override('pt-BR'):
rendered = self.TEMPLATE_NAME.render(Context({'code': 'BR'}))
self.assertEqual(rendered, 'Brasil')
Expand Down

0 comments on commit dfa9f35

Please sign in to comment.