Last active
August 29, 2015 14:22
-
-
Save jpetto/5376bf49ff61c392449e to your computer and use it in GitHub Desktop.
possible /mozorg/tests/test_views.py fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@patch('bedrock.mozorg.views.l10n_utils.render') | |
class TestHome(TestCase): | |
def setUp(self): | |
self.rf = RequestFactory() | |
@override_settings(MOBILIZER_LOCALE_LINK={'en-US': 'His Dudeness', 'de': 'Herr Dude'}) | |
def test_gets_right_mobilizer_url(self, resp_mock): | |
"""Home page should get correct mobilizer link for locale.""" | |
req = self.rf.get('/') | |
req.locale = 'de' | |
views.home(req) | |
ctx = resp_mock.call_args[0][2] | |
# here's a comment! | |
self.assertEqual(ctx['mobilizer_link'], 'Herr Dude') | |
@override_settings(MOBILIZER_LOCALE_LINK={'en-US': 'His Dudeness', 'de': 'Herr Dude'}) | |
def test_gets_default_mobilizer_url(self, resp_mock): | |
"""Home page should get default mobilizer link for other locale.""" | |
req = self.rf.get('/') | |
req.locale = 'xx' # does not exist | |
views.home(req) | |
ctx = resp_mock.call_args[0][2] | |
self.assertEqual(ctx['mobilizer_link'], 'His Dudeness') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment