예제 #1
0
    def test_positive_search_by_title(self):
        """Search for newly created OS by title

        @id: a555e848-f1f2-4326-aac6-9de8ff45abee

        @assert: Operating System is created and listed
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'title=\\"%s\\"' % os['title']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #2
0
    def test_positive_search_by_name(self):
        """Search for newly created OS by name

        @id: ff9f667c-97ca-49cd-902b-a9b18b5aa021

        @assert: Operating System is created and listed
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'name=%s' % os['name']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #3
0
    def test_positive_list(self):
        """Displays list for operating system

        @id: fca309c5-edff-4296-a800-55470669935a

        @assert: Operating System is created and listed
        """
        os_list_before = OperatingSys.list()
        name = gen_string('alpha')
        os = make_os({'name': name})
        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #4
0
    def test_list_1(self):
        """@test: Displays list for operating system

        @feature: Operating System - List

        @assert: Operating System is created and listed

        """
        os_list_before = OperatingSys.list()
        name = gen_string('alpha')
        os = make_os({'name': name})
        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #5
0
    def test_positive_search_by_name(self):
        """Search for newly created OS by name

        :id: ff9f667c-97ca-49cd-902b-a9b18b5aa021

        :expectedresults: Operating System is created and listed

        :CaseImportance: Critical
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'name=%s' % os['name']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #6
0
    def test_verify_redmine_4547(self):
        """Search for newly created OS by name

        @feature: Operating System - Search

        @assert: Operating System is created and listed

        @bz: redmine#4547
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'name=%s' % os['name']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #7
0
    def test_addoperatingsystem_ptable(self):
        """@Test: Check if Partition Table can be associated with operating system

        @Feature: Partition Table - Add operating system

        @Assert: Operating system added

        """

        content = "Fake ptable"
        name = generate_name(6)
        try:
            make_partition_table({'name': name, 'content': content})
        except CLIFactoryError as err:
            self.fail(err)
        result = PartitionTable().exists(tuple_search=('name', name))
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        ptable = result.stdout

        os_list = OperatingSys.list()
        self.assertEqual(os_list.return_code, 0, "Failed to list os")
        self.assertEqual(
            len(os_list.stderr), 0, "Should not have gotten an error")

        args = {'id': ptable['id'],
                'operatingsystem-id': os_list.stdout[0]['id']}

        result = PartitionTable().add_operating_system(args)
        self.assertEqual(result.return_code, 0, "Association Failed")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")
예제 #8
0
    def test_positive_search_by_title(self):
        """Search for newly created OS by title

        :id: a555e848-f1f2-4326-aac6-9de8ff45abee

        :expectedresults: Operating System is created and listed

        :CaseImportance: Critical
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'title=\\"%s\\"' % os['title']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #9
0
    def test_verify_redmine_4547(self):
        """@test: Search for newly created OS by name

        @feature: Operating System - Search

        @assert: Operating System is created and listed

        @bz: redmine#4547
        """
        os_list_before = OperatingSys.list()
        os = make_os()
        os_list = OperatingSys.list({'search': 'name=%s' % os['name']})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        self.assertEqual(os['id'], os_info['id'])
        os_list_after = OperatingSys.list()
        self.assertGreater(len(os_list_after), len(os_list_before))
예제 #10
0
    def test_positive_list(self):
        """Displays list for operating system

        :id: fca309c5-edff-4296-a800-55470669935a

        :expectedresults: Operating System is created and listed

        :CaseImportance: Critical
        """
        os_list_before = OperatingSys.list()
        name = gen_string('alpha')
        os = make_os({'name': name})
        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list[0]['id']})
        assert os['id'] == os_info['id']
        os_list_after = OperatingSys.list()
        assert len(os_list_after) > len(os_list_before)
예제 #11
0
    def test_redmine_4547(self):
        """
        @test: Search for newly created OS by name
        @feature: Operating System - List
        @assert: Operating System is created and listed
        @bz: redmine#4547
        """
        result = OperatingSys.list()
        self.assertEqual(result.return_code, 0)
        length = len(result.stdout)
        result = make_os()
        name = result['name']
        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list.stdout[0]['id']})

        self.assertEqual(result['id'], os_info.stdout['id'])
        result = OperatingSys.list()
        self.assertGreater(len(result.stdout), length)
        self.assertEqual(result.return_code, 0)
예제 #12
0
    def test_list_1(self):
        """
        @test: Displays list for operating system
        @feature: Operating System - List
        @assert: Operating System is created and listed
        """
        result = OperatingSys.list()
        self.assertEqual(result.return_code, 0)
        length = len(result.stdout)

        name = generate_string("alpha", 10)
        result = make_os({'name': name})

        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list.stdout[0]['id']})

        self.assertEqual(result['id'], os_info.stdout['id'])
        result = OperatingSys.list()
        self.assertGreater(len(result.stdout), length)
        self.assertEqual(result.return_code, 0)
예제 #13
0
    def test_redmine_4547(self):
        """@test: Search for newly created OS by name

        @feature: Operating System - List

        @assert: Operating System is created and listed

        @bz: redmine#4547

        """
        result = OperatingSys.list()
        self.assertEqual(result.return_code, 0)
        length = len(result.stdout)
        result = make_os()
        name = result['name']
        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list.stdout[0]['id']})

        self.assertEqual(result['id'], os_info.stdout['id'])
        result = OperatingSys.list()
        self.assertGreater(len(result.stdout), length)
        self.assertEqual(result.return_code, 0)
예제 #14
0
    def test_list_1(self):
        """@test: Displays list for operating system

        @feature: Operating System - List

        @assert: Operating System is created and listed

        """
        result = OperatingSys.list()
        self.assertEqual(result.return_code, 0)
        length = len(result.stdout)

        name = gen_string("alpha", 10)
        result = make_os({'name': name})

        os_list = OperatingSys.list({'search': 'name=%s' % name})
        os_info = OperatingSys.info({'id': os_list.stdout[0]['id']})

        self.assertEqual(result['id'], os_info.stdout['id'])
        result = OperatingSys.list()
        self.assertGreater(len(result.stdout), length)
        self.assertEqual(result.return_code, 0)
예제 #15
0
    def test_positive_add_os_by_id(self):
        """Create a partition table then add an operating system to it

        @Feature: Partition Table

        @Assert: Operating system is added to partition table

        """
        content = "Fake ptable"
        ptable = make_partition_table({'content': content})
        os_list = OperatingSys.list()
        PartitionTable().add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os_list[0]['id']
        })
예제 #16
0
    def test_addoperatingsystem_ptable(self):
        """@Test: Check if Partition Table can be associated
                  with operating system

        @Feature: Partition Table - Add operating system

        @Assert: Operating system added

        """
        content = "Fake ptable"
        ptable = make_partition_table({'content': content})
        os_list = OperatingSys.list()
        PartitionTable().add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os_list[0]['id']
        })
예제 #17
0
    def test_addoperatingsystem_ptable(self):
        """@Test: Check if Partition Table can be associated
                  with operating system

        @Feature: Partition Table - Add operating system

        @Assert: Operating system added

        """

        content = "Fake ptable"
        name = gen_alphanumeric(6)
        try:
            make_partition_table({'name': name, 'content': content})
        except CLIFactoryError as err:
            self.fail(err)
        result = PartitionTable().exists(search=('name', name))
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        ptable = result.stdout

        os_list = OperatingSys.list()
        self.assertEqual(os_list.return_code, 0, "Failed to list os")
        self.assertEqual(len(os_list.stderr), 0,
                         "Should not have gotten an error")

        args = {
            'id': ptable['id'],
            'operatingsystem-id': os_list.stdout[0]['id']
        }

        result = PartitionTable().add_operating_system(args)
        self.assertEqual(result.return_code, 0, "Association Failed")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")
예제 #18
0
    def test_positive_create_with_synced_content(self):
        """Check if hostgroup with synced kickstart repository can be created

        :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a

        :customerscenario: true

        :expectedresults: Hostgroup should be created and has proper
            installation content id present

        :BZ: 1415707

        :CaseLevel: Integration
        """
        # Check whether path to kickstart media is set
        if settings.rhel6_os is None:
            raise ValueError(
                'Installation media path is not set in properties file')
        # Common entities
        org = make_org()
        lce = make_lifecycle_environment({'organization-id': org['id']})
        product = make_product({'organization-id': org['id']})
        repo = make_repository({
            u'url': settings.rhel6_os,
            u'product-id': product['id'],
            u'content-type': u'yum',
        })
        Repository.synchronize({'id': repo['id']})

        cv = make_content_view({
            'organization-id': org['id'],
            'repository-ids': [repo['id']],
        })
        ContentView.publish({'id': cv['id']})
        cv = ContentView.info({'id': cv['id']})
        cvv = cv['versions'][0]
        ContentView.version_promote({
            'id': cvv['id'],
            'to-lifecycle-environment-id': lce['id'],
        })

        # Get the Partition table ID
        ptable = PartitionTable.info({'name': DEFAULT_PTABLE})

        # Get the arch ID
        arch = Architecture.list(
            {'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0]

        # Get the OS ID
        os = OperatingSys.list({
            'search':
            'name="RedHat" AND major="{0}" OR major="{1}"'.format(
                RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION)
        })[0]

        # Update the OS with found arch and ptable
        OperatingSys.update({
            'id': os['id'],
            'architectures': arch['name'],
            'partition-tables': ptable['name'],
        })
        proxy = Proxy.list({
            'search':
            'url = https://{0}:9090'.format(settings.server.hostname)
        })[0]

        # Search for proper installation repository id
        synced_repo = Repository.list({
            'content-view-version-id': cvv['id'],
            'organization-id': org['id'],
            'environment-id': lce['id'],
        })[0]
        hostgroup = make_hostgroup({
            'lifecycle-environment-id':
            lce['id'],
            'puppet-proxy-id':
            proxy['id'],
            'puppet-ca-proxy-id':
            proxy['id'],
            'content-source-id':
            proxy['id'],
            'content-view-id':
            cv['id'],
            'organization-ids':
            org['id'],
            'architecture-id':
            arch['id'],
            'partition-table-id':
            ptable['id'],
            'operatingsystem-id':
            os['id'],
            'kickstart-repository-id':
            synced_repo['id'],
        })
        hg = HostGroup.info({'id': hostgroup['id']}, output_format='json')
        self.assertEqual(hg['kickstart-repository']['id'], synced_repo['id'])
예제 #19
0
    def test_positive_create_with_synced_content(self):
        """Check if hostgroup with synced kickstart repository can be created

        :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a

        :customerscenario: true

        :expectedresults: Hostgroup should be created and has proper
            installation content id present

        :BZ: 1415707

        :CaseLevel: Integration
        """
        # Check whether path to kickstart media is set
        if settings.rhel6_os is None:
            raise ValueError(
                'Installation media path is not set in properties file')
        # Common entities
        org = make_org()
        lce = make_lifecycle_environment({'organization-id': org['id']})
        product = make_product({'organization-id': org['id']})
        repo = make_repository({
            u'url': settings.rhel6_os,
            u'product-id': product['id'],
            u'content-type': u'yum',
        })
        Repository.synchronize({'id': repo['id']})

        cv = make_content_view({
            'organization-id': org['id'],
            'repository-ids': [repo['id']],
        })
        ContentView.publish({'id': cv['id']})
        cv = ContentView.info({'id': cv['id']})
        cvv = cv['versions'][0]
        ContentView.version_promote({
            'id': cvv['id'],
            'to-lifecycle-environment-id': lce['id'],
        })

        # Get the Partition table ID
        ptable = PartitionTable.info({'name': DEFAULT_PTABLE})

        # Get the arch ID
        arch = Architecture.list({
            'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0]

        # Get the OS ID
        os = OperatingSys.list({
            'search': 'name="RedHat" AND major="{0}" OR major="{1}"'.format(
                RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION)
        })[0]

        # Update the OS with found arch and ptable
        OperatingSys.update({
            'id': os['id'],
            'architectures': arch['name'],
            'partition-tables': ptable['name'],
        })
        proxy = Proxy.list({
            'search': 'url = https://{0}:9090'.format(settings.server.hostname)
        })[0]

        # Search for proper installation repository id
        synced_repo = Repository.list({
            'content-view-version-id': cvv['id'],
            'organization-id': org['id'],
            'environment-id': lce['id'],
        })[0]
        hostgroup = make_hostgroup({
            'lifecycle-environment-id': lce['id'],
            'puppet-proxy-id': proxy['id'],
            'puppet-ca-proxy-id': proxy['id'],
            'content-source-id': proxy['id'],
            'content-view-id': cv['id'],
            'organization-ids': org['id'],
            'architecture-id': arch['id'],
            'partition-table-id': ptable['id'],
            'operatingsystem-id': os['id'],
            'kickstart-repository-id': synced_repo['id'],
        })
        hg = HostGroup.info({'id': hostgroup['id']}, output_format='json')
        self.assertEqual(
            hg['operating-system']['kickstart_repository_id'],
            synced_repo['id']
        )