Ejemplo n.º 1
0
    def test_get_single_path_failure(self, mock_download_one):
        report = DownloadReport('http://pulpproject.org/v1/repositories/pulp/crane/images',
                                StringIO(''))
        report.headers = {}
        report.state = report.DOWNLOAD_FAILED
        mock_download_one.return_value = report

        self.assertRaises(IOError, self.repo._get_single_path, '/v1/repositories/pulp/crane/images')
Ejemplo n.º 2
0
    def test_get_single_path_failure(self, mock_download_one):
        report = DownloadReport('http://pulpproject.org/v1/repositories/pulp/crane/images',
                                StringIO(''))
        report.headers = {}
        report.state = report.DOWNLOAD_FAILED
        mock_download_one.return_value = report

        self.assertRaises(IOError, self.repo._get_single_path, '/v1/repositories/pulp/crane/images')
Ejemplo n.º 3
0
    def test__get_path_failed(self, mock_download_one, mock_request_token):
        """
        Test _get_path() for the case when an IOError is raised by the downloader.
        """
        name = 'pulp'
        download_config = DownloaderConfig(max_concurrent=25)
        registry_url = 'https://registry.example.com'
        working_dir = '/a/working/dir'
        r = registry.V2Repository(name, download_config, registry_url, working_dir)

        report = DownloadReport(registry_url + '/some/path', StringIO())
        report.error_report['response_code'] = httplib.UNAUTHORIZED
        report.state = DownloadReport.DOWNLOAD_FAILED
        mock_download_one.return_value = report

        # The request will fail because the requested path does not exist
        self.assertRaises(IOError, r._get_path, '/some/path')
Ejemplo n.º 4
0
    def test__get_path_failed(self, mock_download_one, mock_request_token):
        """
        Test _get_path() for the case when an IOError is raised by the downloader.
        """
        name = 'pulp'
        download_config = DownloaderConfig(max_concurrent=25)
        registry_url = 'https://registry.example.com'
        working_dir = '/a/working/dir'
        r = registry.V2Repository(name, download_config, registry_url, working_dir)

        report = DownloadReport(registry_url + '/some/path', StringIO())
        report.error_report['response_code'] = httplib.UNAUTHORIZED
        report.state = DownloadReport.DOWNLOAD_FAILED
        report.headers = {}
        mock_download_one.return_value = report

        # The request will fail because the requested path does not exist
        self.assertRaises(IOError, r._get_path, '/some/path')