Exemple #1
0
class TestSysreqRedirect(TestCase):
    def _test(self, url_from, url_to):
        with self.activate('en-US'):
            url = '/en-US' + url_from
        response = self.client.get(url)
        assert response.status_code == 302
        assert response['Location'] == '/en-US' + url_to

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(
               product='Firefox', version='22.0', channel='Release')))
    def test_desktop_release_version(self):
        self._test('/firefox/system-requirements/',
                   '/firefox/22.0/system-requirements/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(
               product='Firefox', version='23.0beta', channel='Beta')))
    def test_desktop_beta_version(self):
        self._test('/firefox/beta/system-requirements/',
                   '/firefox/23.0beta/system-requirements/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(
               product='Firefox', version='23.0beta', channel='Beta')))
    def test_desktop_developer_version(self):
        self._test('/firefox/developer/system-requirements/',
                   '/firefox/23.0beta/system-requirements/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(
               product='Firefox', version='24.2.0', channel='ESR')))
    def test_desktop_esr_version(self):
        self._test('/firefox/organizations/system-requirements/',
                   '/firefox/24.2.0/system-requirements/')
Exemple #2
0
class TestNotesRedirects(TestCase):
    def _test(self, url_from, url_to):
        with self.activate('en-US'):
            url = '/en-US' + url_from
        response = self.client.get(url)
        eq_(response.status_code, 302)
        eq_(response['Location'], 'http://testserver/en-US' + url_to)

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox', version='22.0', channel='Release')))
    def test_desktop_release_version(self):
        self._test('/firefox/notes/',
                   '/firefox/22.0/releasenotes/')
        self._test('/firefox/latest/releasenotes/',
                   '/firefox/22.0/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox', version='23.0beta', channel='Beta')))
    def test_desktop_beta_version(self):
        self._test('/firefox/beta/notes/',
                   '/firefox/23.0beta/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox', version='23.0beta', channel='Beta')))
    def test_desktop_developer_version(self):
        self._test('/firefox/developer/notes/',
                   '/firefox/23.0beta/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox', version='24.2.0', channel='ESR')))
    def test_desktop_esr_version(self):
        self._test('/firefox/organizations/notes/',
                   '/firefox/24.2.0/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox for Android', version='22.0', channel='Release')))
    def test_android_release_version(self):
        self._test('/firefox/android/notes/',
                   '/firefox/android/22.0/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox for Android', version='23.0beta', channel='Beta')))
    def test_android_beta_version(self):
        self._test('/firefox/android/beta/notes/',
                   '/firefox/android/23.0beta/releasenotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox for Android', version='24.0a2', channel='Aurora')))
    def test_android_aurora_version(self):
        self._test('/firefox/android/aurora/notes/',
                   '/firefox/android/24.0a2/auroranotes/')

    @patch('bedrock.releasenotes.views.get_latest_release_or_404',
           Mock(return_value=ProductRelease(product='Firefox for iOS', version='1.4', channel='Release')))
    def test_ios_release_version(self):
        self._test('/firefox/ios/notes/',
                   '/firefox/ios/1.4/releasenotes/')
Exemple #3
0
class TestSysreqRedirect(TestCase):
    def _test(self, url_from, url_to):
        with self.activate("en-US"):
            url = "/en-US" + url_from
        response = self.client.get(url)
        assert response.status_code == 302
        assert response["Location"] == "/en-US" + url_to

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="22.0", channel="Release")),
    )
    def test_desktop_release_version(self):
        self._test("/firefox/system-requirements/",
                   "/firefox/22.0/system-requirements/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="23.0beta", channel="Beta")),
    )
    def test_desktop_beta_version(self):
        self._test("/firefox/beta/system-requirements/",
                   "/firefox/23.0beta/system-requirements/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="23.0beta", channel="Beta")),
    )
    def test_desktop_developer_version(self):
        self._test("/firefox/developer/system-requirements/",
                   "/firefox/23.0beta/system-requirements/")

    @patch("bedrock.releasenotes.views.get_latest_release_or_404",
           Mock(return_value=ProductRelease(
               product="Firefox", version="24.2.0", channel="ESR")))
    def test_desktop_esr_version(self):
        self._test("/firefox/organizations/system-requirements/",
                   "/firefox/24.2.0/system-requirements/")
Exemple #4
0
class TestNotesRedirects(TestCase):
    def _test(self, url_from, url_to):
        with self.activate("en-US"):
            url = "/en-US" + url_from
        response = self.client.get(url)
        assert response.status_code == 302
        assert response["Location"] == "/en-US" + url_to

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="22.0", channel="Release")),
    )
    def test_desktop_release_version(self):
        self._test("/firefox/notes/", "/firefox/22.0/releasenotes/")
        self._test("/firefox/latest/releasenotes/",
                   "/firefox/22.0/releasenotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="23.0beta", channel="Beta")),
    )
    def test_desktop_beta_version(self):
        self._test("/firefox/beta/notes/", "/firefox/23.0beta/releasenotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox", version="23.0beta", channel="Beta")),
    )
    def test_desktop_developer_version(self):
        self._test("/firefox/developer/notes/",
                   "/firefox/23.0beta/releasenotes/")

    @patch("bedrock.releasenotes.views.get_latest_release_or_404",
           Mock(return_value=ProductRelease(
               product="Firefox", version="24.2.0", channel="ESR")))
    def test_desktop_esr_version(self):
        self._test("/firefox/organizations/notes/",
                   "/firefox/24.2.0/releasenotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox for Android", version="22.0", channel="Release")),
    )
    def test_android_release_version(self):
        self._test("/firefox/android/notes/",
                   "/firefox/android/22.0/releasenotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(product="Firefox for Android",
                                         version="23.0beta",
                                         channel="Beta")),
    )
    def test_android_beta_version(self):
        self._test("/firefox/android/beta/notes/",
                   "/firefox/android/23.0beta/releasenotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(product="Firefox for Android",
                                         version="24.0a2",
                                         channel="Aurora")),
    )
    def test_android_aurora_version(self):
        self._test("/firefox/android/aurora/notes/",
                   "/firefox/android/24.0a2/auroranotes/")

    @patch(
        "bedrock.releasenotes.views.get_latest_release_or_404",
        Mock(return_value=ProductRelease(
            product="Firefox for iOS", version="1.4", channel="Release")),
    )
    def test_ios_release_version(self):
        self._test("/firefox/ios/notes/", "/firefox/ios/1.4/releasenotes/")