def setUpClass(cls): """Create a Python repo. Upload a Python package into it twice.""" super(DuplicateUploadsTestCase, cls).setUpClass() unit = utils.http_get(PYTHON_EGG_URL) unit_type_id = "python_package" client = api.Client(cls.cfg, api.json_handler) repo_href = client.post(REPOSITORY_PATH, gen_repo())["_href"] cls.resources.add(repo_href) cls.call_reports = tuple((utils.upload_import_unit(cls.cfg, unit, unit_type_id, repo_href) for _ in range(2)))
def create_repo(self, cfg, importer_config): """Create a Python repository with the given importer config. Schedule it for deletion. Return its href. """ client = api.Client(cfg, api.json_handler) body = gen_repo() body['importer_config'] = importer_config repo_href = client.post(constants.REPOSITORY_PATH, body)['_href'] self.addCleanup(client.delete, repo_href) return repo_href
def setUpClass(cls): """Create a Python repo. Upload a Python package into it twice.""" super(DuplicateUploadsTestCase, cls).setUpClass() if (cls.cfg.version >= Version('2.11') and selectors.bug_is_untestable(2334, cls.cfg.version)): raise unittest.SkipTest('https://pulp.plan.io/issues/2334') unit = utils.http_get(PYTHON_EGG_URL) unit_type_id = 'python_package' client = api.Client(cls.cfg, api.json_handler) repo_href = client.post(REPOSITORY_PATH, gen_repo())['_href'] cls.resources.add(repo_href) cls.upload_import_unit_args = (cls.cfg, unit, unit_type_id, repo_href)
def create_body(): """Return a dict for creating a repository.""" return gen_repo()