def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/pulp/tags/list') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {} report.destination.write('{"name": "pulp", "tags": ["best_ever", "latest", "decent"]}') return report
def download_one(request): """ Mock the download_one() method. """ self.assertEqual(request.url, 'https://registry.example.com/some/path') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {'some': 'cool stuff'} report.destination.write("This is the stuff you've been waiting for.") return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {'Docker-Distribution-API-Version': 'registry/2.0'} report.destination.write("") return report
def download_one(request): """ Mock the download_one() method. """ self.assertEqual(request.url, 'https://registry.example.com/some/path') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {'some': 'cool stuff'} report.destination.write("This is the stuff you've been waiting for.") return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/pulp/tags/list') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {} report.destination.write('{"name": "pulp", "tags": ["best_ever", "latest", "decent"]}') return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() report.headers = {'Docker-Distribution-API-Version': 'registry/2.0'} report.destination.write("") return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() # The Version header is not present report.headers = {} report.destination.write("") return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() # The Version header is not present report.headers = {} report.destination.write("") return report
def download_one(request): """ Mock the download_one() method to manipulate the path. """ self.assertEqual(request.url, 'https://registry.example.com/v2/pulp/manifests/best_version_ever') self.assertEqual(type(request.destination), type(StringIO())) report = DownloadReport(request.url, request.destination) report.download_succeeded() schema2 = 'application/vnd.docker.distribution.manifest.v2+json' report.headers = {'Docker-Distribution-API-Version': 'registry/2.0', 'docker-content-digest': digest, 'content-type': schema2} report.destination.write(manifest) return report