# Path: mrburns/main/views.py
# TWITTER_URL = 'https://twitter.com/share'
# FB_URL = 'https://www.facebook.com/sharer/sharer.php'
# COUNT_FOOTNOTE = ('<a href="#number-modal" class="number-help" '
#                   'data-toggle="modal" title="{}">'
#                   '<span class="share_total"></span>'
#                   '<i class="fa fa-question-circle"></i></a>')
# ISSUE_CHOICES = (
#     Issue('privacy', 'fa-eye', _lazy('Safeguards privacy')),
#     Issue('opportunity', 'fa-heart', _lazy('Creates opportunity')),
#     Issue('access', 'fa-user', _lazy('Is available to all')),
#     Issue('freedom', 'fa-check-circle-o', _lazy('Promotes freedom')),
#     Issue('learning', 'fa-book', _lazy('Inspires learning')),
#     Issue('control', 'fa-cogs', _lazy('Puts me in control')),
# )
# def uca_sort_key(country):
# def get_tw_share_url(**kwargs):
# def get_fb_share_url(url):
# def fix_locale(locale):
# def get_sorted_countries_list(locale):
#     def get_context_data(self, **kwargs):
#     def get_countries_list(self):
#     def is_long_headline(self):
#     def post(self, request):
# class GlowView(TemplateView):
# class ShareView(View):
# class StringsView(TemplateView):


from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from nose.tools import ok_, eq_
from mrburns.main import views
    @override_settings(EXTRA_COUNTRIES={})
    def test_sorted_countries_list_unicode(self):
        """Should return a properly sorted list of countries by name."""
        with patch.object(views, 'product_details') as mock_get:
            mock_get.get_regions.return_value = {
                u'us': u'\xc9tats-Unis',
                u'ca': u'Canada',
                u'mx': u'Mexique',
            }
            c_list = views.get_sorted_countries_list('fr')
            self.assertListEqual(c_list, [(u'CA', u'Canada'),
                                          (u'US', u'\xc9tats-Unis'),
                                          (u'MX', u'Mexique')])

    @override_settings(COUNTRY_CODE_MAP={u'SX': u'MF'})
    def test_sorted_countries_list_map(self):
        """Mapped codes in settings should show correctly in list."""
        with patch.object(views, 'product_details') as mock_get:
            mock_get.get_regions.return_value = {
                u'mf': u'Saint Martin',
            }
            c_list = views.get_sorted_countries_list('en')
            self.assertIn((u'MF', u'Saint Martin'), c_list)
            self.assertIn((u'SX', u'Saint Martin'), c_list)

    def test_fix_locale(self):
        """Should correct certain locales."""
        eq_(views.fix_locale('es'), 'es-ES')
        eq_(views.fix_locale('pt-br'), 'pt-BR')
        eq_(views.fix_locale('zh-tw'), 'zh-TW')

# Path: mrburns/main/views.py
# TWITTER_URL = 'https://twitter.com/share'
# FB_URL = 'https://www.facebook.com/sharer/sharer.php'
# COUNT_FOOTNOTE = ('<a href="#number-modal" class="number-help" '
#                   'data-toggle="modal" title="{}">'
#                   '<span class="share_total"></span>'
#                   '<i class="fa fa-question-circle"></i></a>')
# ISSUE_CHOICES = (
#     Issue('privacy', 'fa-eye', _lazy('Safeguards privacy')),
#     Issue('opportunity', 'fa-heart', _lazy('Creates opportunity')),
#     Issue('access', 'fa-user', _lazy('Is available to all')),
#     Issue('freedom', 'fa-check-circle-o', _lazy('Promotes freedom')),
#     Issue('learning', 'fa-book', _lazy('Inspires learning')),
#     Issue('control', 'fa-cogs', _lazy('Puts me in control')),
# )
# def uca_sort_key(country):
# def get_tw_share_url(**kwargs):
# def get_fb_share_url(url):
# def fix_locale(locale):
# def get_sorted_countries_list(locale):
#     def get_context_data(self, **kwargs):
#     def get_countries_list(self):
#     def is_long_headline(self):
#     def post(self, request):
# class GlowView(TemplateView):
# class ShareView(View):
# class StringsView(TemplateView):


# Path: mrburns/main/tests.py
from django.test import TestCase
from django.test.utils import override_settings
from mock import patch
from nose.tools import ok_, eq_
from mrburns.main import views

    @override_settings(EXTRA_COUNTRIES={})
    def test_sorted_countries_list_unicode(self):
        """Should return a properly sorted list of countries by name."""
        with patch.object(views, 'product_details') as mock_get:
            mock_get.get_regions.return_value = {
                u'us': u'\xc9tats-Unis',
                u'ca': u'Canada',
                u'mx': u'Mexique',
            }
            c_list = views.get_sorted_countries_list('fr')
            self.assertListEqual(c_list, [(u'CA', u'Canada'),
                                          (u'US', u'\xc9tats-Unis'),
                                          (u'MX', u'Mexique')])

    @override_settings(COUNTRY_CODE_MAP={u'SX': u'MF'})
    def test_sorted_countries_list_map(self):
        """Mapped codes in settings should show correctly in list."""
        with patch.object(views, 'product_details') as mock_get:
            mock_get.get_regions.return_value = {
                u'mf': u'Saint Martin',
            }
            c_list = views.get_sorted_countries_list('en')
            self.assertIn((u'MF', u'Saint Martin'), c_list)
            self.assertIn((u'SX', u'Saint Martin'), c_list)

    def test_fix_locale(self):
        """Should correct certain locales."""
        eq_(views.fix_locale('es'), 'es-ES')
        eq_(views.fix_locale('pt-br'), 'pt-BR')
        eq_(views.fix_locale('zh-tw'), 'zh-TW')

        eq_(views.fix_locale('he'), 'he')