Ejemplo n.º 1
0
    def test_country_name(self, product_details):
        product_details.get_regions.side_effect = lambda l: {'au': 'test'}
        with self.activate('fr'):
            name = country_name('au')

        eq_(name, 'test')
        product_details.get_regions.assert_called_with('fr')
Ejemplo n.º 2
0
    def test_country_name_es(self, product_details):
        """
        When `es` is passed as the locale, country_name should use `es-ES` as
        the locale for product_details.
        """
        product_details.get_regions.side_effect = lambda l: {'fr': 'test'}
        with self.activate('es'):
            name = country_name('fr')

        eq_(name, 'test')
        product_details.get_regions.assert_called_with('es-ES')
Ejemplo n.º 3
0
 def test_country_name_empty(self, product_details):
     """If the given country code can't be found, return an empty string."""
     product_details.get_regions.side_effect = lambda l: {'fr': 'test'}
     eq_(country_name('au'), '')