def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) productid = RHSMConstants().get_constant("productid") cmd = "subscription-manager list --consumed" (ret, output) = self.runcmd(cmd, "list the consumed products") if ret == 0: consumed_list = self.parse_listconsumed_output(output) if len(consumed_list ) == 1 and consumed_list[0]["Provides"] != "": logger.info( "It's successful to check collapsed provided products." ) else: raise FailException( "Test Failed - Failed to check collapsed provided products." ) else: raise FailException( "Test Failed - Failed to check collapsed provided products." ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: # register to server username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) cmd = "subscription-manager import" (ret, output) = self.runcmd(cmd, "running import command with no options") if ret != 0 and "Error: This command requires that you specify a certificate with --certificate" in output: logger.info( "It's successful to check the error message when run import with no options." ) else: raise FailException( "Test Failed - Failed to check the error message when run import with no options." ) self.assert_(True, case_name) except Exception, e: logger.error(str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) # list the designated service level servicelevel = RHSMConstants().get_constant("servicelevel") cmd = "subscription-manager service-level --list" (ret, output) = self.runcmd(cmd, "list service level") if ret == 0 and servicelevel.lower() in output.lower(): logger.info("It's successful to list the service level %s." % servicelevel) # set correct service level cmd = "subscription-manager service-level --set=%s" % servicelevel (ret, output) = self.runcmd(cmd, "set correct service level") if ret == 0 and "Service level set to: %s" % servicelevel in output: logger.info( "It's successful to set correct service level %s." % servicelevel) else: raise FailException( "Test Failed - Failed to set correct service level %s." % servicelevel) else: raise FailException( "Test Failed - Failed to list the service level %s." % servicelevel) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") systemname = 'test+?test' cmd = "subscription-manager register --username=%s --password='******' --name=%s" % ( username, password, systemname) (ret, output) = self.runcmd(cmd, "register with valid character in name") if ret != 0: if ("Problem creating unit" in output) or ( "System name cannot contain most special characters." in output): logger.info( "It's successful to verify that invalid systemname can not be used to register." ) else: raise FailException( "Test Failed - The information shown after registered with invalid character in name is not correct." ) else: raise FailException( "Test Failed - Failed to verify registering with invalid system name." ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) self.click_view_system_facts_menu() self.check_window_exist('system-facts-dialog') self.check_object_status("main-window", "system-facts-dialog", "VISIBLE") logger.info("SUCCESS: System facts visible!") self.check_object_status("main-window", "system-facts-dialog", "ENABLED") logger.info("SUCCESS: System facts enabled!") self.assert_(True, case_name) except Exception, e: logger.error("FAILED - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) # get service_level service_level = RHSMConstants().get_constant("servicelevel") # set service level self.sub_set_servicelevel(service_level) # auto attach autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # list consumed subscriptions matching specified service level cmd = "subscription-manager list --consumed --servicelevel=%s" % service_level (ret, output) = self.runcmd(cmd, "list consumed subscriptions matching specified service level") if ret == 0 : logger.info("It's successful to list consumed subscriptions matching specified service level.") if self.check_servicelevel_in_listconsumed_ouput(output, service_level) : logger.info("It's successful to check specified service level in the ouput of listing consumed subscriptions.") else: raise FailException("Test Failed - Failed to check specified service level in the ouput of listing consumed subscriptions.") else: raise FailException("Test Failed - Failed to list consumed subscriptions matching specified service level.") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: self.check_and_backup_yum_repos() username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") autosubprod = RHSMConstants().get_constant("autosubprod") pkgtoinstall = RHSMConstants().get_constant("pkgtoinstall") # register to and auto-attach self.register_and_autosubscribe(username, password, autosubprod) # unregister self.sub_unregister() # install a pkg cmd = "yum install -y %s" % (pkgtoinstall) (ret, output) = self.runcmd( cmd, "install selected package %s" % pkgtoinstall) if ret == 1: logger.info( "It's successful to verify that system cannot access CDN contents through thumbslug with revoked cert" ) else: raise FailException( "Test Failed - failed to verify that system cannot access CDN contents through thumbslug with revoked cert" ) self.assert_(True, case_name) except Exception, e: logger.error(str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) cmd = "subscription-manager unsubscribe" (ret, output) = self.runcmd( cmd, "running unsubscribe command with no options") if ret != 0 and "Error: This command requires that you specify one of --serial or --all" in output: logger.info( "It's successful to check the error message when run unsubscribe with no options." ) else: raise FailException( "Test Failed - Failed to check the error message when run unsubscribe with no options." ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) productid = RHSMConstants().get_constant("productid") # self.click_my_installed_products_tab() # for item in self.sub_listinstalledpools(): # if not self.check_content_in_my_installed_products_table(item["SubscriptionName"]): # raise FailException("Test Faild - Failed to list %s in all-subscription-table" % item["SubscriptionName"]) self.click_my_subscriptions_tab() for item in self.sub_listconsumedpools(): if not self.check_content_in_my_subscriptions_table( item["SubscriptionName"]): raise FailException( "Test Faild - Failed to list %s in my-subscription-table" % item["SubscriptionName"]) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_update_button() logger.info( 'PROGRESS: Looking at Service_level of first available subscription...' ) if (self.select_row('main-window', 'all-subscription-table', 0) == -1): raise FailException( "FAILED: Seems like you have no subscriptions!") service_label = self.get_label_txt('main-window', 'text-service-level') print service_label if service_label[-1] == ',': raise FailException( "FAILED: There's a comma at the end of the service_label. Check to see if that is correct!" ) self.assert_(True, case_name) except Exception, e: logger.error("FAILED - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: # register to server username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) productrepo = RHSMConstants().get_constant("productrepo") cmd = "subscription-manager repos --list | grep %s" % productrepo (ret, output) = self.runcmd(cmd, "check the repo %s" % productrepo) if ret == 0 and productrepo in output: logger.info("It's successful to check the repo %s which is available." % productrepo) # disable the repo in list cmd = "subscription-manager repos --disable=%s" % productrepo (ret, output) = self.runcmd(cmd, "disable the repo %s" % productrepo) if ret == 0 and "Repository '%s' is disabled for this system." % productrepo in output: logger.info("It's successful to disable the repo %s." % productrepo) else: raise FailException("Test Failed - Failed to disable the repo %s." % productrepo) else: raise FailException("Test Failed - Fail to check the repo %s which should be available." % productrepo) self.assert_(True, case_name) except Exception, e: logger.error(str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # list installed products installedproductname = RHSMConstants().get_constant( "installedproductname") cmd = "subscription-manager list --installed" (ret, output) = self.runcmd(cmd, "list installed products") if ret == 0 and installedproductname in output: logger.info("It's successful to list installed product %s." % (installedproductname)) return True else: raise FailException( "Test Failed - The product %s is not installed." % (installedproductname)) return False self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # unsubscribe all products cmd = "subscription-manager unsubscribe --all" (ret, output) = self.runcmd(cmd, "unsubscribe") expectout = "This machine has been unsubscribed from" # for rhel6.4 new output version expectoutnew64 = "subscription removed from this system." # for rhel5.10 new output version expectoutnew510 = "subscription removed at the server." if ret == 0 and (expectout in output or expectoutnew510 in output or expectoutnew64 in output): if len(os.listdir('/etc/pki/entitlement')) <= 0: logger.info( "It's successful to unsubscribe from all products.") else: raise FailException( "Test Failed - The information shown that it's failed to unsubscribe from all products." ) else: raise FailException( "Test Failed - Failed to unsubscribe from all products.") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_filters_button() if self.verifycheck_checkbox( "filter-options-window", "match-system-checkbox") and self.verifycheck_checkbox( "filter-options-window", "do-not-overlap-checkbox"): logger.info( "It's successful to check two_filter_options_enabled_by_default" ) else: raise FailException( "Test Faild - Failed to check two_filter_options_enabled_by_default" ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: # register the system username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) cmd = 'subscription-manager identity' (ret, output) = self.runcmd(cmd, "running identity command") if ret == 0 and (('system identity' in output) and ('name' in output) and ('org name' in output) and ('org id' in output or 'org ID' in output)): logger.info( "It's successful to check the output of identity command when the machine is registered." ) else: raise FailException( "Test Failed - Failed to check the output of identity command when the machine is registered." ) self.assert_(True, case_name) except Exception, e: logger.error(str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.check_consumer_cert_files(exist=False) self.click_register_button() self.click_configure_proxy_button() self.check_HTTP_proxy_checkbox() self.input_HTTP_proxy("squid.corp.redhat.com:3128") self.click_proxy_close_button() self.click_dialog_next_button() self.input_username(username) self.input_password(password) self.check_manual_attach_checkbox() self.click_dialog_register_button_without_autoattach() self.check_consumer_cert_files(exist=True) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.remove_proxy() self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) #list consumed subscriptions installedproductname = RHSMConstants().get_constant( "installedproductname") self.list_consumed_subscriptions(installedproductname) #Unsubscribe the consumed subscription via the serial number cmd = "subscription-manager unsubscribe --serial=1234567890" (ret, output) = self.runcmd( cmd, "Unsubscribe the consumed subscription via the wrong cert serial number" ) if (ret != 0) and ("could not be found" in output) and ("unsuccessfully removed" in output): logging.info( "It's successful to check Unsubscribe the consumed subscription via the wrong cert serial number" ) else: raise FailException( "Test Failed - Failed to check Unsubscribe the consumed subscription via the wrong cert serial number" ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # record the entitlement cert cmd = "ls /etc/pki/entitlement/*.pem | grep -v key.pem" (ret, certname0) = self.runcmd(cmd, "get the entitlement cert name") if (ret == 0) and (certname0 != None): logger.info("It's successful to get the entitlement cert name") certname = certname0.strip('\n') else: raise FailException( "Test Failed - Failed to get the entitlement cert name") # list consumed subscription, record the account number, and display the account number in entitlement cert self.display_number(certname, "Account") # list consumed subscription, record the contract number, and display the contract number in entitlement cert self.display_number(certname, "Contract") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") invalidpassword = "******" if password == invalidpassword: logger.info( "the invalid password happens to be a valid password, please choose another invalid password!" ) else: cmd = "subscription-manager register --username=%s --password='******'" % ( username, invalidpassword) (ret, output) = self.runcmd( cmd, "register with invalid username and password") if ret != 0: if ("Invalid credentials" in output): logger.info( "It's successful to verify that invalid password can not be used to register." ) else: raise FailException( "Test Failed - The information shown after registeration with invalid username and password is not correct." ) else: raise FailException( "Test Failed - Failed to verify registering with invalid username and password." ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") baseurl = RHSMConstants().get_constant("baseurl") samhostip = RHSMConstants().samhostip # register to sam candlepin server if samhostip != None: serverurl = baseurl + '/sam/api' cmd = "subscription-manager register --username=%s --password=%s --serverurl=%s --org=ACME_Corporation" % ( username, password, serverurl) # register to stage/product candlepin server else: serverurl = baseurl + '/subscription' cmd = "subscription-manager register --username=%s --password=%s --serverurl=%s" % ( username, password, serverurl) (ret, output) = self.runcmd(cmd, "register to selected server") if ret == 0 and ("The system has been registered with ID:" in output) or ( "The system has been registered with id:" in output): logger.info( "It is successful to register system to selected server.") else: raise FailException( "Test Failed - Failed to rigster system to selected server." ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_filters_button() self.uncheck_checkbox("filter-options-window", "match-system-checkbox") self.uncheck_checkbox("filter-options-window", "do-not-overlap-checkbox") self.uncheck_checkbox("filter-options-window", "match-installed-checkbox") #input garbage in the filter box self.input_text('filter-options-window','filter-subscriptions-text','testy1') self.click_filter_close_button() self.click_update_button() self.click_filters_button() #input garbage in the filter box 2nd time self.input_text('filter-options-window','filter-subscriptions-text','testy2') self.click_filter_close_button() self.click_update_button() self.check_window_exist('main-window') except Exception, e: logger.error("FAILED - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) # register to server username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) try: # get baseurl baseurl = RHSMConstants().get_constant("baseurl") samhostip = RHSMConstants().samhostip if "8443" in baseurl: baseurl = baseurl + "/candlepin" elif samhostip == None: baseurl = baseurl + "/subscription" else: baseurl = baseurl + "/sam/api" # get consumerid cmd = "subscription-manager identity | grep identity" (ret, output) = self.runcmd(cmd, "get consumerid") consumerid = output.split(':')[1].strip() # Delete the consumer from candlepin server cmd = "curl -X DELETE -k -u %s:%s %s/consumers/%s" % ( username, password, baseurl, consumerid) (ret, output) = self.runcmd(cmd, "delete consumer from candlepin server") if ret == 0: logger.info( "It's successful to delete consumer from candlepin server." ) else: raise FailException( "Test Failed - Failed to delete consumer from candlepin server." ) # Check deleted consumer status cmd = "subscription-manager identity" (ret, output) = self.runcmd(cmd, "check deleted consumer status") print "check output:\n", output if ret != 0: logger.info( "It's successful to check deleted consumer status.") else: raise FailException( "Test Failed - Failed to check deleted consumer status.") self.assert_(True, case_name) except Exception, e: logger.error(str(e)) raise FailException( "Test Failed - error happened when verify consumer status after being deleted from server:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: samhostip = RHSMConstants().samhostip if samhostip == None: logger.info("It's not sam test, so skip this case") else: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") org = 'ACME_Corporation' cmd = "subscription-manager register --username=%s --password=%s --org=%s" % ( username, password, org) (ret, output) = self.runcmd(cmd, "register without environments") if ret == 0 and ( "The system has been registered with ID" in output or "The system has been registered with id" in output): logger.info( "It's successful to verify that sam support registration without environments" ) else: raise FailException( "Test Failed - failed to verify that sam support registration without environments" ) self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) self.click_my_subscriptions_tab() if self.get_my_subscriptions_table_row_count() >= 1: logger.info("It's successful to auto subscribe: %s" % self.get_my_subscriptions_table_my_subscriptions()) else: raise FailException("Test Faild - Failed to register and auto subscribe via GUI!") self.click_remove_subscriptions_button() self.check_window_exist("rhsm-notification-dialog") if self.check_object_exist("rhsm-notification-dialog", "rhsm-notification-dialog") : logger.info("It's successful to check rhsm-notification-dialog exist") else: raise FailException("Test Faild - Failed to check rhsm-notification-dialog exist") if self.get_my_subscriptions_table_row_count() == 0: logger.info("It's successful to check unsubscribed product disappear from the table") else: raise FailException("Test Faild - Failed to check unsubscribed product disappear from the table") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_update_button() self.select_row('main-window','all-subscription-table', 0) self.click_button('main-window','attach-subscription') self.select_row('main-window','all-subscription-table', 1) self.click_button('main-window','attach-subscription') self.click_my_subscriptions_tab() #find all consumed pools in a dict sub_dict = self.sub_listconsumedpools() #go through the dictionary and dheck whether pools match for i in xrange(len(sub_dict)): if self.get_table_cell('main-window','my-subscription-table', i, 0) != sub_dict[i]['SubscriptionName']: raise FailException('FAILED: My consumed subscriptions do not match the ones listed in GUI!') self.assert_(True, case_name) except Exception, e: logger.error("FAILED - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) # create invaild pem file cmd = "touch /root/testinvalid.pem" (ret, output) = self.runcmd(cmd, "create invalid pem file") if ret == 0: logger.info(" It's successful to create invalid pem file.") else: raise FailException("Test Failed - Failed to create invalied pem file.") # import the invaild pem file cmd = "subscription-manager import --certificate=/root/testinvalid.pem" (ret, output) = self.runcmd(cmd, "import invalid pem file") if ret != 0 and "not a valid certificate file" in output: logger.info("It's successful to check import invalid cert file.") else: raise FailException("Test Failed - Failed to check import invalid cert file.") # list consumed subscriptions cmd = "subscription-manager list --consumed" (ret, output) = self.runcmd(cmd, "list consumed subscriptions") if (ret == 0) and ("No consumed subscription pools" in output): logger.info("It's successful to check consumed subscriptions.") else: raise FailException("Test Failed - Failed to check consumed subscriptions.") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.open_subscription_manager() self.register_and_autosubscribe_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_update_button() #look trhough the entire table and find a subscription with a comma for i in xrange(self.get_table_row_count('main-window','all-subscription-table')): if "," in self.get_table_cell('main-window','all-subscription-table',i,0): self.select_row('main-window','all-subscription-table', i) old_comma_name = self.get_table_cell('main-window','all-subscription-table', i, 0) self.click_button('main-window','attach-subscription') break self.click_my_subscriptions_tab() sub_index = self.get_table_row_index('main-window','my-subscription-table',old_comma_name) if sub_index == -1: raise FailException('FAILED: Unable to find the subscribed product with comma in name') #we found the exact name, therefore, the 'and' could not have been added in! and so we must pass! self.assert_(True, case_name) except Exception, e: logger.error("FAILED - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) # register to server username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) try: # auto subscribe to a pool autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # list available releases currentversion = self.sub_getcurrentversion() cmd = "subscription-manager release --list" (ret, output) = self.runcmd(cmd, "list available releases") if ret == 0 and currentversion in output: logger.info("It's successful to list available releases.") else: raise FailException( "Test Failed - Failed to list available releases.") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % case_name) try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") self.sub_register(username, password) autosubprod = RHSMConstants().get_constant("autosubprod") self.sub_autosubscribe(autosubprod) # run cmd with release only cmd = "subscription-manager release" (ret, output) = self.runcmd(cmd, "running release without option") releaseout = output # run cmd with release --show cmd = "subscription-manager release --show" (ret, output) = self.runcmd(cmd, "running release with option: --show") releaseshowout = output if releaseout == releaseshowout : logger.info("It's successfull to check the default output of release: the output of release is the same as release --show!") else: raise FailException("Test Faild - Failed to check the default output of repos: the output of release is not the same as release --show!") self.assert_(True, case_name) except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name)
def test_run(self): case_name = self.__class__.__name__ logger.info("========== Begin of Running Test Case %s ==========" % self.__class__.__name__) try: try: username = RHSMConstants().get_constant("username") password = RHSMConstants().get_constant("password") if not(self.check_window_exist_fast('main-window')): self.open_subscription_manager() self.register_in_gui(username, password) self.click_all_available_subscriptions_tab() self.click_filters_button() #input garbage in the filter box self.input_text('filter-options-window','filter-subscriptions-text','asfsadfasdfasdf') self.click_filter_close_button() self.click_update_button() ldtp.wait() os.execv(__file__, sys.argv) #check if the no subscriptions label is there #THE OBJECT LIST PRINTED HERE IS BUGGY AND WILL NOT REFRESH UNTIL PYTHON IS RESTARTED! #Therefore, we will need to do the check AFTER restarting python, which the following code will handle else: if not(self.check_object_exist('main-window','nosubscriptions-in-filter-label')): raise FailException("FAILED: Can't find No-subscriptions-label!") except Exception, e: logger.error("Test Failed - ERROR Message:" + str(e)) self.assert_(False, case_name) finally: self.capture_image(case_name) self.restore_gui_environment() logger.info("========== End of Running Test Case: %s ==========" % case_name)