def test_workflow_01(self): """ Verify workflow 1 """ created_contents = [] for pkg, filename in zip(self.PACKAGES_URLS, PYTHON_FIXTURES_FILENAMES): content_response = self.content_api.create( **gen_python_content_attrs(gen_artifact(pkg), filename)) created_contents.extend( monitor_task(content_response.task).created_resources) created_contents = [ self.content_api.read(href).to_dict() for href in created_contents ] repo = self._create_repository() # Add content modify_repo(cfg, repo.to_dict(), add_units=created_contents) repo = self.repo_api.read(repo.pulp_href) pub = self._create_publication(repo) distro = self._create_distribution_from_publication(pub) self.addCleanup(delete_orphans, cfg) self.check_consume(distro.to_dict())
def test_01_create_content_unit(self): """Create content unit.""" attrs = gen_python_content_attrs(self.artifact) response = self.content_api.create(**attrs) created_resources = monitor_task(response.task).created_resources content_unit = self.content_api.read(created_resources[0]) self.content_unit.update(content_unit.to_dict()) self.check_package_data(self.content_unit)
def test_03_fully_update(self): """Attempt to update a content unit using HTTP PUT. This HTTP method is not supported and a HTTP exception is expected. """ attrs = gen_python_content_attrs(self.artifact) with self.assertRaises(AttributeError) as exc: self.content_api.update(self.content_unit["pulp_href"], attrs) msg = "object has no attribute 'update'" self.assertIn(msg, exc.exception.args[0])
def test_workflow_01(self): """ Verify workflow 1 """ repo = self.repo_api.create(gen_repo()) self.addCleanup(self.repo_api.delete, repo.pulp_href) artifacts = [] for pkg in self.PACKAGES_URLS: artifacts.append(gen_artifact(pkg)) for filename, artifact in zip(PYTHON_FIXTURES_FILENAMES, artifacts): content_response = self.content_api.create( **gen_python_content_attrs(artifact, filename)) created_resources = monitor_task(content_response.task) self.repo_api.modify(repo.pulp_href, {"add_content_units": created_resources}) repo = self.repo_api.read(repo.pulp_href) distribution = self.gen_pub_dist(repo) self.addCleanup(delete_orphans, cfg) self.check_consume(distribution.to_dict())