def test_firefox_os_manual_template(self, get_release_or_404): """ Should render from pre-RNA template without querying DB """ views.release_notes(self.request, '1.0.1', product='Firefox OS') get_release_or_404.assert_never_called() eq_(self.mock_render.call_args[0][1], 'firefox/os/notes-1.0.1.html')
def test_release_notes(self, mock_equiv_rel_url, get_release_or_404): """ 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.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], 'firefox/releases/release-notes.html') mock_equiv_rel_url.assert_called_with(mock_release)
def test_release_notes_beta_redirect(self, releasenotes_url, get_release_or_404): """ Should redirect to url for beta release """ get_release_or_404.side_effect = [Http404, 'mock release'] releasenotes_url.return_value = '/firefox/27.0beta/releasenotes/' response = views.release_notes(self.request, '27.0') eq_(response.status_code, 302) eq_(response['location'], '/firefox/27.0beta/releasenotes/') get_release_or_404.assert_called_with('27.0beta', 'Firefox') releasenotes_url.assert_called_with('mock release')
def test_release_notes(self, mock_equiv_rel_url, get_release_or_404): """ 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.notes.return_value = ('mock new_features', 'mock known_issues') views.release_notes(self.request, '27.0') # Should use fixed version for query get_release_or_404.assert_called_with('27.0', 'Firefox') # Should use original version for context variable eq_(self.last_ctx['version'], '27.0') eq_(self.last_ctx['release'], mock_release) eq_(self.last_ctx['new_features'], 'mock new_features') eq_(self.last_ctx['known_issues'], 'mock known_issues') eq_(self.mock_render.call_args[0][1], 'firefox/releases/release-notes.html') mock_equiv_rel_url.assert_called_with(mock_release)