def test_fetch_langpack_invalid_path_fails(self): self.mock_request.return_value = None try: tasks.fetch_langpacks('../foo/') except ValueError, e: eq_(e.message, 'Invalid path')
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
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.side_effect = lambda url, **kw: responses.get(url) self.mock_request.call_args_list = [] tasks.fetch_langpacks(path) eq_(self.mock_request.call_args_list, [mock.call(list_url, verify=settings.CA_CERT_BUNDLE_PATH), mock.call(langpack_url, verify=settings.CA_CERT_BUNDLE_PATH)])
def test_fetch_langpack_invalid_path_fails(self): self.mock_request.return_value = None with self.assertRaises(ValueError) as exc: tasks.fetch_langpacks('../foo/') eq_(str(exc.exception), 'Invalid path')
def fetch_langpacks(self, version): self.mock_urlopen.return_value = RequestMock(self.LISTING) self.mock_request.return_value = RequestMock(make_langpack(version)) tasks.fetch_langpacks(settings.LANGPACK_PATH_DEFAULT % ('firefox', version))