예제 #1
0
    def test_release_notes(self, mock_equiv_rel_url, get_release_or_404,
                           mock_release_notes_template):
        """
        Should use release returned from get_release_or_404 with the
        correct params and pass the correct context variables and
        template to l10n_utils.render.
        """
        mock_release = get_release_or_404.return_value
        mock_release.major_version.return_value = '34'
        mock_release.notes.return_value = ([Release(id=1),
                                            Release(id=2)],
                                           [Release(id=3),
                                            Release(id=4)])

        views.release_notes(self.request, '27.0')
        get_release_or_404.assert_called_with('27.0', 'Firefox')
        mock_release.notes.assert_called_with(public_only=True)
        eq_(self.last_ctx['version'], '27.0')
        eq_(self.last_ctx['release'], mock_release)
        eq_(self.last_ctx['new_features'], [Release(id=1), Release(id=2)])
        eq_(self.last_ctx['known_issues'], [Release(id=3), Release(id=4)])
        eq_(self.mock_render.call_args[0][1],
            mock_release_notes_template.return_value)
        mock_equiv_rel_url.assert_called_with(mock_release)
        mock_release_notes_template.assert_called_with(mock_release.channel,
                                                       'Firefox', 34)
예제 #2
0
 def test_non_public_release(self, get_object_or_404):
     """
     Should raise 404 if not release.is_public and not settings.DEV
     """
     get_object_or_404.return_value = Release(is_public=False)
     with self.assertRaises(Http404):
         views.get_release_or_404('42', 'Firefox')
예제 #3
0
 def test_firefox_os_releasenotes_url(self, mock_reverse):
     """
     Should return the results of reverse with the correct args
     """
     release = Release(version='42.0', product='Firefox OS')
     eq_(releasenotes_url(release), mock_reverse.return_value)
     mock_reverse.assert_called_with('firefox.os.releasenotes',
                                     args=['42.0'])
예제 #4
0
 def test_desktop_releasenotes_url(self, mock_reverse):
     """
     Should return the results of reverse with the correct args
     """
     release = Release(version='42.0', product='Firefox')
     eq_(releasenotes_url(release), mock_reverse.return_value)
     mock_reverse.assert_called_with('firefox.desktop.releasenotes',
                                     args=('42.0', 'release'))
예제 #5
0
 def test_aurora_android_releasenotes_url(self, mock_reverse):
     """
     Should return the results of reverse with the correct args
     """
     release = Release(
         channel='Aurora', version='42.0a2', product='Firefox for Android')
     eq_(releasenotes_url(release), mock_reverse.return_value)
     mock_reverse.assert_called_with(
         'firefox.android.releasenotes', args=('42.0a2', 'aurora'))