Ejemplo n.º 1
0
    def test_fetch_langpack_invalid_path_fails(self, mock_sign_file):
        self.mock_request.return_value = None

        with self.assertRaises(ValueError) as exc:
            tasks.fetch_langpacks('../foo/')
        assert str(exc.exception) == 'Invalid path'

        assert not mock_sign_file.called
Ejemplo n.º 2
0
    def test_fetch_langpack_invalid_path_fails(self, mock_sign_file):
        self.mock_request.return_value = None

        with self.assertRaises(ValueError) as exc:
            tasks.fetch_langpacks('../foo/')
        assert str(exc.exception) == 'Invalid path'

        assert not mock_sign_file.called
Ejemplo n.º 3
0
    def fetch_langpacks(self, version):
        path = settings.LANGPACK_PATH_DEFAULT % ('firefox', version)

        base_url = urlparse.urljoin(settings.LANGPACK_DOWNLOAD_BASE, path)
        list_url = urlparse.urljoin(base_url, settings.LANGPACK_MANIFEST_PATH)
        langpack_url = urlparse.urljoin(base_url, 'de-DE.xpi')

        responses = {list_url: RequestMock(self.LISTING),
                     langpack_url: RequestMock(make_langpack(version))}

        self.mock_request.reset_mock()
        self.mock_request.side_effect = lambda url, **kw: responses.get(url)

        tasks.fetch_langpacks(path)

        self.mock_request.assert_has_calls(
            [mock.call(list_url, verify=settings.CA_CERT_BUNDLE_PATH),
             mock.call(langpack_url, verify=settings.CA_CERT_BUNDLE_PATH)])
Ejemplo n.º 4
0
    def fetch_langpacks(self, version):
        path = settings.LANGPACK_PATH_DEFAULT % ('firefox', version)

        base_url = urlparse.urljoin(settings.LANGPACK_DOWNLOAD_BASE, path)
        list_url = urlparse.urljoin(base_url, settings.LANGPACK_MANIFEST_PATH)
        langpack_url = urlparse.urljoin(base_url, 'de-DE.xpi')

        responses = {list_url: RequestMock(self.LISTING),
                     langpack_url: RequestMock(make_langpack(version))}

        self.mock_request.reset_mock()
        self.mock_request.side_effect = lambda url, **kw: responses.get(url)

        tasks.fetch_langpacks(path)

        self.mock_request.assert_has_calls(
            [mock.call(list_url, verify=settings.CA_CERT_BUNDLE_PATH),
             mock.call(langpack_url, verify=settings.CA_CERT_BUNDLE_PATH)])