def setUpClass(cls): """Upload an erratum to a repo, publish, and download the erratum. Do the following: 1. Create an RPM repository with a distributor. 2. Upload an erratum to the repository. 3. Publish the repository. 4. Fetch the repository's ``updateinfo.xml`` file. """ super(UploadErratumTestCase, cls).setUpClass() cls.erratum = gen_erratum() # Create an RPM repository with a feed and distributor. client = api.Client(cls.cfg, api.json_handler) body = gen_repo() body['importer_config']['feed'] = RPM_FEED_URL body['distributors'] = [gen_distributor()] repo = client.post(REPOSITORY_PATH, body) cls.resources.add(repo['_href']) # Sync content into the repository, and give it an erratum. utils.sync_repo(cls.cfg, repo['_href']) utils.upload_import_erratum(cls.cfg, cls.erratum, repo['_href']) repo = client.get(repo['_href'], params={'details': True}) # Publish the repository, and fetch and parse updateinfo.xml distributor = repo['distributors'][0] client.post( urljoin(repo['_href'], 'actions/publish/'), {'id': distributor['id']}, ) path = urljoin('/pulp/repos/', distributor['config']['relative_url']) cls.updateinfo = get_repomd_xml(cls.cfg, path, 'updateinfo')
def setUpClass(cls): """Upload an erratum to a repo, publish, and download the erratum. Do the following: 1. Create an RPM repository with a distributor. 2. Upload an erratum to the repository. 3. Publish the repository. 4. Fetch the repository's ``updateinfo.xml`` file. """ super(UploadErratumTestCase, cls).setUpClass() if check_issue_2387(cls.cfg): raise unittest.SkipTest('https://pulp.plan.io/issues/2387') if check_issue_2277(cls.cfg): raise unittest.SkipTest('https://pulp.plan.io/issues/2277') cls.erratum = gen_erratum() # Create an RPM repository with a feed and distributor. client = api.Client(cls.cfg, api.json_handler) body = gen_repo() body['importer_config']['feed'] = RPM_SIGNED_FEED_URL body['distributors'] = [gen_distributor()] repo = client.post(REPOSITORY_PATH, body) cls.resources.add(repo['_href']) # Sync content into the repository, and give it an erratum. utils.sync_repo(cls.cfg, repo['_href']) utils.upload_import_erratum(cls.cfg, cls.erratum, repo['_href']) repo = client.get(repo['_href'], params={'details': True}) # Publish the repository, and fetch and parse updateinfo.xml utils.publish_repo(cls.cfg, repo) path = urljoin( '/pulp/repos/', repo['distributors'][0]['config']['relative_url'] ) cls.updateinfo = get_repomd_xml(cls.cfg, path, 'updateinfo')
def setUpClass(cls): """Upload an erratum to a repo, publish, and download the erratum. Do the following: 1. Create an RPM repository with a distributor. 2. Upload an erratum to the repository. 3. Publish the repository. 4. Fetch the repository's ``updateinfo.xml`` file. """ super(UploadErratumTestCase, cls).setUpClass() if check_issue_2277(cls.cfg): raise unittest.SkipTest('https://pulp.plan.io/issues/2277') cls.erratum = gen_erratum() # Create an RPM repository with a feed and distributor. client = api.Client(cls.cfg, api.json_handler) body = gen_repo() body['importer_config']['feed'] = RPM_SIGNED_FEED_URL body['distributors'] = [gen_distributor()] repo = client.post(REPOSITORY_PATH, body) cls.resources.add(repo['_href']) # Sync content into the repository, and give it an erratum. utils.sync_repo(cls.cfg, repo['_href']) utils.upload_import_erratum(cls.cfg, cls.erratum, repo['_href']) repo = client.get(repo['_href'], params={'details': True}) # Publish the repository, and fetch and parse updateinfo.xml distributor = repo['distributors'][0] client.post( urljoin(repo['_href'], 'actions/publish/'), {'id': distributor['id']}, ) path = urljoin('/pulp/repos/', distributor['config']['relative_url']) cls.updateinfo = get_repomd_xml(cls.cfg, path, 'updateinfo')