def test_load_same_manifest_to_same_org_wo_force(self, mozwebqa):
        '''
        Scenario 2 with a twist. Import Manifest (M1) from Distributor (D1) into 
        Org1 w/o useing force.
        Result: Expect Fail
        '''
        sysapi = ApiTasks(mozwebqa)
        home_page = Home(mozwebqa)
        
        new_org_name = "manifest%s" % home_page.random_string()
        sysapi.create_org(new_org_name)
        
        home_page.login()

        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(new_org_name)
        home_page.header.click_filtered_result(new_org_name)

        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")

        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()

        cm.enter_manifest(os.path.realpath(self._scenario2_m1_d1_manifest))

        cm.enter_manifest(os.path.realpath(self._scenario2_m1_d1_manifest))
        Assert.true(home_page.is_failed)
    def test_load_manifest(self, mozwebqa):
        '''
        Scenario 1: Import Manifest (M1) from Distributor (D1) input Org1
        Result: Pass
        '''
        sysapi = ApiTasks(mozwebqa)
        home_page = Home(mozwebqa)
        
        new_org_name = "manifest%s" % home_page.random_string()
        sysapi.create_org(new_org_name)
        
        home_page.login()

        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(new_org_name)
        home_page.header.click_filtered_result(new_org_name)

        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")
        
        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()
 
        cm.enter_manifest(os.path.realpath(self._org1_m1_manifest))
        Assert.true(home_page.is_successful)
        Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
    def test_NumberFormatException_forInputString(self, mozwebqa):
        """
        Regression Test for bz786963
        """
        home_page = Home(mozwebqa)
        sysapi = ApiTasks(mozwebqa)
        
        new_org_name = "manifest-%s" % home_page.random_string()
        sysapi.create_org(new_org_name)
        
        home_page.login()

        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(new_org_name)
        home_page.header.click_filtered_result(new_org_name)

        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")

        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()

        cm.enter_manifest(os.path.realpath(self._bz786963_manifest))
        Assert.true(home_page.is_successful)
        Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
    def test_load_new_manifest_into_same_org_wo_force(self, mozwebqa):
        '''
        Scenario 5: Load updated (new) manifest into org where a manifest already exists.
        Result: Pass
        '''
        sysapi = ApiTasks(mozwebqa)
        home_page = Home(mozwebqa)
        
        new_org_name = "manifest-%s" % home_page.random_string()
        sysapi.create_org(new_org_name)
        
        home_page.login()

        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(new_org_name)
        home_page.header.click_filtered_result(new_org_name)

        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")

        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()

        cm.enter_manifest(os.path.realpath(self._scenario5_o1_m1_manifest))
        cm.enter_manifest(os.path.realpath(self._scenario5_o1_m2_manifest))
        
        Assert.true(home_page.is_successful)
        Assert.not_equal(cm.get_content_table_text, "No subscriptions have been imported.")
    def test_activation_key_workflow(self, mozwebqa):
        """
        Return True of a activation key can be created and a single
        subscription from a multi subscription manifest can be
        added.
        """
        home_page = Home(mozwebqa)
        api = ApiTasks(mozwebqa)
        _new_org_name = "activationkeyorg%s" % home_page.random_string()
        api.create_org(_new_org_name)
        api.create_envs(_new_org_name)
        
        home_page.login()
        
        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(_new_org_name)
        home_page.header.click_filtered_result(_new_org_name)
        
        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")
        
        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()
            
        cm.enter_manifest(self._activationkey_manifest)
        home_page.is_dialog_cleared
        
        activationkeys = ActivationKeysTab(mozwebqa)
        home_page.tabs.click_tab("systems_tab")
        home_page.jquery_wait(30)
        home_page.tabs.click_tab("activation_keys")
        
        _new_activationkey_name = "%s" % home_page.random_string()
        activationkeys.click_new()
        activationkeys.enter_activation_key_name(_new_activationkey_name)
        activationkeys.enter_activation_key_description(_new_activationkey_name)
        activationkeys.click_save()

        activationkeys.click_available_subscriptions()
        
        rand_sub_id = activationkeys.select_a_random_sub()
        activationkeys.click_add_sub()

        activationkeys.click_applied_subscriptions()
        Assert.true(activationkeys.find_sub_by_id(rand_sub_id))
    def test_load_same_manifest_to_same_org_w_force(self, mozwebqa):
        '''
        Scenario 2: Re-import same manifest into same org.
        Result: Pass
        '''
        home_page = Home(mozwebqa)
        sysapi = ApiTasks(mozwebqa)
        
        new_org_name = "manifest-%s" % home_page.random_string()
        sysapi.create_org(new_org_name)
        
        home_page.login()

        home_page.header.click_switcher()
        home_page.header.filter_org_in_switcher(new_org_name)
        home_page.header.click_filtered_result(new_org_name)

        cm = ContentManagementTab(mozwebqa)
        home_page.tabs.click_tab("content_management_tab")
        '''
        Need to clean this up a bit
        '''
        if home_page.project == "katello" or home_page.project == "cfse":
            cm.click_content_providers()
            cm.select_redhat_content_provider()
         
        cm.enter_manifest(os.path.realpath(self._org4_m1_manifest))
        
        cm.click_force()
        cm.enter_manifest(os.path.realpath(self._org4_m1_manifest))
        Assert.true(home_page.is_successful)