def test_26_fetch_available_pool(): '''Fetch the available pool ID''' available_pool = RHUIManagerCLI.subscriptions_list(CONNECTION, "available", True) nose.tools.ok_(re.search(r'^[0-9a-f]+$', available_pool) is not None) with open(AVAILABLE_POOL_FILE, "w") as apf: apf.write(available_pool)
def test_27_register_subscription(): '''Register the subscription using the fetched pool ID''' with open(AVAILABLE_POOL_FILE) as apf: available_pool = apf.read() nose.tools.ok_(re.search(r'^[0-9a-f]+$', available_pool) is not None) RHUIManagerCLI.subscriptions_register(CONNECTION, available_pool)
def test_09_check_certificate_info(): '''Check certificate info for validity''' RHUIManagerCLI.cert_info(CONNECTION)
def test_12_add_rh_repo_by_product(self): '''Add a Red Hat repo by its product name''' RHUIManagerCLI.repo_add(CONNECTION, self.yum_repo_name_1)
def test_05_check_custom_repo(): '''Check if the custom repo was actually created''' RHUIManagerCLI.repo_list(CONNECTION, CUSTOM_REPO_NAME, CUSTOM_REPO_NAME)
def test_07_check_package_in_custom_repo(): '''Check that the uploaded package is now in the repo''' RHUIManagerCLI.packages_list(CONNECTION, CUSTOM_REPO_NAME, "rhui-rpm-upload-test-1-1.noarch.rpm")
def test_18_check_package_in_repo(self): '''Check a random package in the repo''' RHUIManagerCLI.packages_list(CONNECTION, self.yum_repo_id_2, "ostree")
def test_31_unregister_subscription(): '''Remove the subscription from RHUI''' with open(REGISTERED_POOL_FILE) as rpf: registered_pool = rpf.read() nose.tools.ok_(re.search(r'^[0-9a-f]+$', registered_pool) is not None) RHUIManagerCLI.subscriptions_unregister(CONNECTION, registered_pool)
def test_16_start_syncing_repo(self): '''Sync one of the repos''' RHUIManagerCLI.repo_sync(CONNECTION, self.yum_repo_id_2, self.yum_repo_name_2)
def test_17_repo_info(self): '''Verify that the repo name is part of the information about the specified repo ID''' RHUIManagerCLI.repo_info(CONNECTION, self.yum_repo_id_2, self.yum_repo_name_2)
def test_15_no_unexpected_repos(self): '''Check if no stray repo was added''' RHUIManagerCLI.validate_repo_list(CONNECTION, [self.yum_repo_id_1, self.yum_repo_id_2, CUSTOM_REPO_NAME])
def test_14_repo_list(self): '''Check the added repos''' RHUIManagerCLI.repo_list(CONNECTION, self.yum_repo_id_1, self.yum_repo_name_1) RHUIManagerCLI.repo_list(CONNECTION, self.yum_repo_id_2, self.yum_repo_name_2)
def test_13_add_rh_repo_by_id(self): '''Add a Red Hat repo by its ID''' RHUIManagerCLI.repo_add_by_repo(CONNECTION, [self.yum_repo_id_2])
def test_28_fetch_registered_pool(): '''Fetch the registered pool ID''' registered_pool = RHUIManagerCLI.subscriptions_list(CONNECTION, "registered", True) nose.tools.ok_(re.search(r'^[0-9a-f]+$', registered_pool) is not None) with open(REGISTERED_POOL_FILE, "w") as rpf: rpf.write(registered_pool)
def test_19_list_labels(self): '''Check repo labels''' repo_label = self.yum_repo_id_1.replace("-x86_64", "") RHUIManagerCLI.repo_labels(CONNECTION, repo_label)
def test_30_check_reg_pool_for_rhui(self): '''Check if the registered subscription's description is RHUI for CCSP''' list_reg = RHUIManagerCLI.subscriptions_list(CONNECTION) nose.tools.ok_(self.subscription_name_1 in list_reg, msg="Expected subscription not registered in RHUI! Got: " + list_reg)
def test_20_generate_entitlement_certificate(self): '''Generate an entitlement certificate''' repo_label_1 = self.yum_repo_id_1.replace("-x86_64", "") repo_label_2 = self.yum_repo_id_2.replace("-x86_64", "") RHUIManagerCLI.client_cert(CONNECTION, [repo_label_1, repo_label_2], "atomic_and_my", 365, "/tmp")
def test_33_resync_repo(self): '''Sync the repo again''' RHUIManagerCLI.repo_sync(CONNECTION, self.yum_repo_id_2, self.yum_repo_name_2)
def test_21_create_client_configuration_rpm(): '''Create a client configuration RPM''' RHUIManagerCLI.client_rpm(CONNECTION, "/tmp/atomic_and_my.key", "/tmp/atomic_and_my.crt", "1.0", "atomic_and_my", "/tmp", [CUSTOM_REPO_NAME])
def test_06_upload_rpm_to_custom_repo(): '''Upload content to the custom repo''' RHUIManagerCLI.packages_upload(CONNECTION, CUSTOM_REPO_NAME, "/tmp/extra_rhui_files/rhui-rpm-upload-test-1-1.noarch.rpm")
def test_23_upload_expired_entitlement_certificate(): '''Bonus: Check expired certificate handling''' # currently, an error occurs RHUIManagerCLI.cert_upload(CONNECTION, "/tmp/extra_rhui_files/rhcert_expired.pem", "An unexpected error has occurred during the last operation") # a relevant traceback is logged, though; check it Expect.ping_pong(CONNECTION, "tail -1 /root/.rhui/rhui.log", "InvalidOrExpiredCertificate")
def test_08_upload_entitlement_certificate(): '''Upload the Atomic (the small) entitlement certificate''' RHUIManagerCLI.cert_upload(CONNECTION, "/tmp/extra_rhui_files/rhcert_atomic.pem", "Atomic")
def test_24_upload_incompatible_entitlement_certificate(): '''Bonus #2: Check incompatible certificate handling''' # an error message is printed right away RHUIManagerCLI.cert_upload(CONNECTION, "/tmp/extra_rhui_files/rhcert_incompatible.pem", "not compatible with the RHUI")
def test_10_check_certificate_expiration(): '''Check if the certificate expiration date is OK''' RHUIManagerCLI.cert_expiration(CONNECTION)
def test_11_check_unused_product(self): '''Check if a repo is available''' RHUIManagerCLI.repo_unused(CONNECTION, self.yum_repo_name_1)