def test_18_repo_select_0(): '''check if no repo is chosen if 0 is entered when adding a repo''' # for RHBZ#1305612 # upload the small cert and try entering 0 when the list of repos is displayed RHUIManagerEntitlements.upload_rh_certificate( RHUA, "/tmp/extra_rhui_files/rhcert_atomic.pem") RHUIManager.screen(RHUA, "repo") Expect.enter(RHUA, "a") Expect.expect(RHUA, "Enter value", 180) Expect.enter(RHUA, "3") Expect.expect(RHUA, "Enter value") Expect.enter(RHUA, "0") Expect.expect(RHUA, "Enter value") Expect.enter(RHUA, "c") Expect.expect(RHUA, "Proceed") Expect.enter(RHUA, "y") Expect.expect(RHUA, "Content") Expect.enter(RHUA, "q") # the RHUI repo list ought to be empty now; if not, delete the repo and fail repo_list = RHUIManagerRepo.list(RHUA) RHUIManager.remove_rh_certs(RHUA) if repo_list: RHUIManagerRepo.delete_all_repos(RHUA) raise AssertionError("The repo list is not empty: %s." % repo_list)
def test_99_cleanup(self): '''clean up''' Expect.expect_retval(CLI, "rhui-set-release --unset") Util.remove_rpm(CLI, [self.test_package, CONF_RPM_NAME]) RHUIManagerCLI.repo_delete(RHUA, self.repo_id) Expect.expect_retval(RHUA, "rm -rf /tmp/%s*" % CONF_RPM_NAME) if not getenv("RHUISKIPSETUP"): RHUIManager.remove_rh_certs(RHUA) RHUICLI.delete(RHUA, "haproxy", force=True) RHUICLI.delete(RHUA, "cds", force=True) ConMgr.remove_ssh_keys(RHUA)
def test_99_cleanup(): '''Cleanup: Delete all repositories from RHUI (interactively; not currently supported by the CLI), remove certs and other files''' RHUIManagerRepo.delete_all_repos(CONNECTION) nose.tools.assert_equal(RHUIManagerRepo.list(CONNECTION), []) RHUIManager.remove_rh_certs(CONNECTION) Expect.ping_pong(CONNECTION, "rm -rf /tmp/atomic_and_my* ; " + "ls /tmp/atomic_and_my* 2>&1", "No such file or directory") Expect.ping_pong(CONNECTION, "rm -f /tmp/repos.std{out,err} ; " + "ls /tmp/repos.std{out,err} 2>&1", "No such file or directory") rmtree(TMPDIR)
def test_99_cleanup(self): '''cleanup: remove repos and temporary files''' RHUIManagerCLI.repo_delete(RHUA, self.product["id"]) RHUIManager.remove_rh_certs(RHUA) Expect.ping_pong( RHUA, "rm -rf /tmp/%s* ; " % CLI_CFG[0] + "ls /tmp/%s* 2>&1" % CLI_CFG[0], "No such file or directory") Expect.ping_pong( RHUA, "rm -f /tmp/repos.std{out,err} ; " + "ls /tmp/repos.std{out,err} 2>&1", "No such file or directory") Expect.ping_pong( RHUA, "rm -rf /tmp/%s* ; " % ALT_CONTENT_SRC_NAME + "ls /tmp/%s* 2>&1" % ALT_CONTENT_SRC_NAME, "No such file or directory") rmtree(TMPDIR)
def test_17_missing_cert_handling(): '''check if rhui-manager can handle the loss of the RH cert''' # for RHBZ#1325390 RHUIManagerEntitlements.upload_rh_certificate(RHUA) # launch rhui-manager in one connection, delete the cert in the other RHUIManager.screen(RHUA, "repo") RHUIManager.remove_rh_certs(RHUA_2) Expect.enter(RHUA, "a") # a bit strange response to see in this context, but eh, no == all if you're a geek Expect.expect( RHUA, "All entitled products are currently deployed in the RHUI") Expect.enter(RHUA, "q") # an error message should be logged, though Expect.ping_pong(RHUA, "tail /root/.rhui/rhui.log", "The entitlement.*has no associated certificate")
def test_99_cleanup(self): ''' remove repos, certs, cli rpms; remove rpms from cli, uninstall cds, hap ''' test_rpm_name = self.custom_rpm.rsplit('-', 2)[0] RHUIManagerRepo.delete_all_repos(RHUA) nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), []) Expect.expect_retval(RHUA, "rm -f /root/test_ent_cli*") Expect.expect_retval(RHUA, "rm -rf /root/test_cli_rpm-3.0/") Util.remove_rpm(CLI, [self.test_package, "test_cli_rpm", test_rpm_name]) rmtree(TMPDIR) Helpers.del_legacy_ca(CDS, LEGACY_CA_FILE) if not getenv("RHUISKIPSETUP"): RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds") RHUIManager.remove_rh_certs(RHUA)
def test_99_cleanup(self): ''' remove the repo and RH cert, uninstall CDS and HAProxy, delete the ostree configuration ''' RHUIManagerRepo.delete_all_repos(RHUA) nose.tools.assert_equal(RHUIManagerRepo.list(RHUA), []) RHUIManagerInstance.delete_all(RHUA, "loadbalancers") RHUIManagerInstance.delete_all(RHUA, "cds") Expect.expect_retval(RHUA, "rm -f /root/test_atomic_ent_cli*") Expect.expect_retval(RHUA, "rm -f /root/test_atomic_pkg.tar.gz") RHUIManager.remove_rh_certs(RHUA) if AH_EXISTS: Expect.expect_retval( ATOMIC_CLI, "ostree remote delete %s" % self.atomic_repo_remote) Expect.expect_retval( ATOMIC_CLI, "mv -f /etc/containers/registries.conf{.backup,}")
def test_43_upload_semi_bad_cert(self): '''check that a partially invalid certificate can still be accepted''' # for RHBZ#1588931 & RHBZ#1584527 # delete currently used certificates and repos first RHUIManager.remove_rh_certs(RHUA) for repo in CUSTOM_REPOS + self.yum_repo_ids: RHUIManagerCLI.repo_delete(RHUA, repo) repolist = RHUIManagerCLI.repo_list(RHUA, True) nose.tools.ok_(not repolist, msg="can't continue as some repos remain: %s" % repolist) # try uploading the cert now cert = "%s/%s" % (DATADIR, CERTS["partial"]) if Util.cert_expired(RHUA, cert): raise nose.exc.SkipTest( "The given certificate has already expired.") RHUIManagerCLI.cert_upload(RHUA, cert) # the RHUI log must contain the fact that an invalid path was found in the cert Expect.ping_pong(RHUA, "tail /root/.rhui/rhui.log", "Invalid entitlement path") RHUIManager.remove_rh_certs(RHUA)
def test_03_remove_existing_entitlement_certificates(): '''Clean up uploaded entitlement certificates''' RHUIManager.remove_rh_certs(CONNECTION)
def test_08_unregister_sub_in_rhui(self): """unregister the subscriptions in RHUI""" RHUIManagerSubMan.subscriptions_unregister(RHUA, self.subscriptions.values()) # also delete the cert files RHUIManager.remove_rh_certs(RHUA)
def test_14_remove_semi_bad_cert(): ''' remove the certificate ''' RHUIManager.remove_rh_certs(RHUA)
def test_10_remove_certificates(): ''' clean up uploaded entitlement certificates ''' RHUIManager.remove_rh_certs(RHUA)
def test_99_cleanup(self): '''remove the RH repo and cert''' RHUIManagerRepo.delete_repo( RHUA, [Util.format_repo(self.yum_repo_name, self.yum_repo_version)]) RHUIManager.remove_rh_certs(RHUA)