コード例 #1
0
    def test_update_ptable(self):
        """@Test: Check if Partition Table can be updated

        @Feature: Partition Table - Update

        @Assert: Partition Table is updated

        """

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

        nw_nm = gen_alphanumeric(6)
        args = {'name': self.name, 'new-name': nw_nm}
        result = PartitionTable().update(args)
        self.assertEqual(result.return_code, 0, "Failed to update object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")
        self.assertFalse(PartitionTable().exists(search=('new-name',
                                                         nw_nm)).stdout)
コード例 #2
0
    def test_positive_delete_by_name(self):
        """Create a Partition Table then delete it by its name

        @Feature: Partition Table

        @Assert: Partition Table is deleted
        """
        ptable = make_partition_table()
        PartitionTable.delete({'name': ptable['name']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'name': ptable['name']})
コード例 #3
0
    def test_positive_delete_by_name(self):
        """Create a Partition Table then delete it by its name

        @id: 27bd427c-7601-4f3b-998f-b7baaaad0fb0

        @Assert: Partition Table is deleted
        """
        ptable = make_partition_table()
        PartitionTable.delete({'name': ptable['name']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'name': ptable['name']})
コード例 #4
0
    def test_positive_delete_by_name(self):
        """Create a Partition Table then delete it by its name

        :id: 27bd427c-7601-4f3b-998f-b7baaaad0fb0

        :expectedresults: Partition Table is deleted
        """
        ptable = make_partition_table()
        PartitionTable.delete({'name': ptable['name']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'name': ptable['name']})
コード例 #5
0
    def test_positive_delete_by_id(self):
        """Create a Partition Table then delete it by its ID

        @id: 4d2369eb-4dc1-4ab5-96d4-c872c39f4ff5

        @Assert: Partition Table is deleted
        """
        ptable = make_partition_table()
        PartitionTable.delete({'id': ptable['id']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'id': ptable['id']})
コード例 #6
0
    def test_positive_delete_by_id(self):
        """Create a Partition Table then delete it by its ID

        @id: 4d2369eb-4dc1-4ab5-96d4-c872c39f4ff5

        @Assert: Partition Table is deleted
        """
        ptable = make_partition_table()
        PartitionTable.delete({'id': ptable['id']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'id': ptable['id']})
コード例 #7
0
    def test_positive_delete_by_id(self):
        """Create a Partition Table then delete it by its ID

        :id: 4d2369eb-4dc1-4ab5-96d4-c872c39f4ff5

        :expectedresults: Partition Table is deleted

        :CaseImportance: Critical
        """
        ptable = make_partition_table()
        PartitionTable.delete({'id': ptable['id']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'id': ptable['id']})
コード例 #8
0
    def test_positive_delete_by_id(self):
        """Create a Partition Table then delete it by its ID

        :id: 4d2369eb-4dc1-4ab5-96d4-c872c39f4ff5

        :expectedresults: Partition Table is deleted

        :CaseImportance: Critical
        """
        ptable = make_partition_table()
        PartitionTable.delete({'id': ptable['id']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'id': ptable['id']})
コード例 #9
0
    def test_positive_delete_by_name(self):
        """Create a Partition Table then delete it by its name

        :id: 27bd427c-7601-4f3b-998f-b7baaaad0fb0

        :expectedresults: Partition Table is deleted

        :CaseImportance: Critical
        """
        ptable = make_partition_table()
        PartitionTable.delete({'name': ptable['name']})
        with self.assertRaises(CLIReturnCodeError):
            PartitionTable.info({'name': ptable['name']})
コード例 #10
0
    def test_positive_add_os_by_id(self):
        """Create a partition table then add an operating system to it using
        IDs for association

        :id: 37415a34-5dba-4551-b1c5-e6e59329f4ca

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({'id': ptable['id'], 'operatingsystem-id': os['id']})
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'], ptable['operating-systems'])
コード例 #11
0
    def test_positive_update_name(self):
        """Create a Partition Table and update its name

        @Feature: Partition Table

        @Assert: Partition Table is created and its name can be updated
        """
        ptable = make_partition_table()
        for new_name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(new_name):
                PartitionTable.update({
                    'id': ptable['id'],
                    'new-name': new_name,
                })
                ptable = PartitionTable.info({'id': ptable['id']})
                self.assertEqual(ptable['name'], new_name)
コード例 #12
0
    def test_add_ptable(self):
        """@test: Add ptable to os

        @feature: Operating System - Add ptable

        @assert: Operating System is updated with ptable

        """
        # Create a partition table.
        ptable_name = make_partition_table()['name']
        response = PartitionTable.info({'name': ptable_name})
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Create an operating system.
        os_id = make_os()['id']
        response = OperatingSys.info({'id': os_id})
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Add the partition table to the operating system.
        response = OperatingSys.add_ptable({
            'id': os_id,
            'partition-table': ptable_name,
        })
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Verify that the operating system has a partition table.
        response = OperatingSys.info({'id': os_id})
        self.assertEqual(len(response.stdout['partition-tables']), 1,
                         response.stdout['partition-tables'])
        self.assertEqual(response.stdout['partition-tables'][0], ptable_name)
コード例 #13
0
    def test_positive_update_name(self):
        """Create a Partition Table and update its name

        :id: 6242c915-0f15-4d5f-9f7a-73cb58fac81e

        :expectedresults: Partition Table is created and its name can be
            updated

        :CaseImportance: Medium
        """
        ptable = make_partition_table()
        for new_name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(new_name):
                PartitionTable.update({'id': ptable['id'], 'new-name': new_name})
                ptable = PartitionTable.info({'id': ptable['id']})
                self.assertEqual(ptable['name'], new_name)
コード例 #14
0
ファイル: test_os.py プロジェクト: connornishijima/robottelo
    def test_add_ptable(self):
        """@test: Add ptable to os

        @feature: Operating System - Add ptable

        @assert: Operating System is updated with ptable

        """

        ptable_obj = make_partition_table()

        result = PartitionTable.info({'id': ptable_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(ptable_obj['name'], result.stdout['name'])

        new_obj = make_os()
        result = OperatingSys.add_ptable({'id': new_obj['id'],
                                          'ptable': ptable_obj['name']})
        self.assertEqual(result.return_code, 0, "Failed to add ptable")
        self.assertEqual(
            len(result.stderr), 0, "Should not have gotten an error")

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to find object")
        self.assertEqual(len(result.stdout['partition-tables']), 1)
        self.assertIn(ptable_obj['name'], result.stdout['partition-tables'][0])
コード例 #15
0
    def test_positive_add_os_by_name(self):
        """Create a partition table then add an operating system to it using
        names for association

        @Feature: Partition Table

        @Assert: Operating system is added to partition table
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertIn(os['title'], ptable['operating-systems'])
コード例 #16
0
    def test_positive_add_os_by_name(self):
        """Create a partition table then add an operating system to it using
        names for association

        :id: ad97800a-0ef8-4ee9-ab49-05c82c77017f

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system(
            {'name': ptable['name'], 'operatingsystem': os['title']}
        )
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertIn(os['title'], ptable['operating-systems'])
コード例 #17
0
    def test_positive_add_os_by_name(self):
        """Create a partition table then add an operating system to it using
        names for association

        :id: ad97800a-0ef8-4ee9-ab49-05c82c77017f

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertIn(os['title'], ptable['operating-systems'])
コード例 #18
0
    def test_positive_add_os_by_id(self):
        """Create a partition table then add an operating system to it using
        IDs for association

        :id: 37415a34-5dba-4551-b1c5-e6e59329f4ca

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'], ptable['operating-systems'])
コード例 #19
0
    def test_positive_update_name(self):
        """Create a Partition Table and update its name

        :id: 6242c915-0f15-4d5f-9f7a-73cb58fac81e

        :expectedresults: Partition Table is created and its name can be
            updated

        :CaseImportance: Critical
        """
        ptable = make_partition_table()
        for new_name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(new_name):
                PartitionTable.update({
                    'id': ptable['id'],
                    'new-name': new_name,
                })
                ptable = PartitionTable.info({'id': ptable['id']})
                self.assertEqual(ptable['name'], new_name)
コード例 #20
0
    def test_positive_create_with_content(self):
        """Create a Partition Table with content

        @id: 28bfbd8b-2ada-44d0-89f3-63885cfb3495

        @Assert: Partition Table is created and has correct content
        """
        content = 'Fake ptable'
        ptable = make_partition_table({'content': content})
        ptable_content = PartitionTable().dump({'id': ptable['id']})
        self.assertTrue(content in ptable_content[0])
コード例 #21
0
    def test_positive_create_with_content(self):
        """Create a Partition Table with content

        @Feature: Partition Table

        @Assert: Partition Table is created and has correct content
        """
        content = 'Fake ptable'
        ptable = make_partition_table({'content': content})
        ptable_content = PartitionTable().dump({'id': ptable['id']})
        self.assertTrue(content in ptable_content[0])
コード例 #22
0
    def test_dump_ptable_1(self):
        """
        @Feature: Partition Table - Create
        @Test: Check if Partition Table can be created with specific content
        @Assert: Partition Table is created
        """

        content = "Fake ptable"
        name = generate_name(6)
        make_partition_table({'name': name, 'content': content})

        ptable = PartitionTable().exists(tuple_search=('name', name)).stdout

        args = {
            'id': ptable['id'],
        }

        ptable_content = PartitionTable().dump(args)

        self.assertTrue(content in ptable_content.stdout[0])
コード例 #23
0
    def test_delete_ptable_1(self):
        """
        @Feature: Partition Table - Delete
        @Test: Check if Partition Table can be deleted
        @Assert: Partition Table is deleted
        """

        content = "Fake ptable"
        name = generate_name(6)
        make_partition_table({'name': name, 'content': content})

        ptable = PartitionTable().exists(tuple_search=('name', name)).stdout

        args = {
            'id': ptable['id'],
        }

        PartitionTable().delete(args)
        self.assertFalse(PartitionTable().exists(tuple_search=('name',
                                                               name)).stdout)
コード例 #24
0
    def test_positive_create_with_content(self):
        """Create a Partition Table with content

        :id: 28bfbd8b-2ada-44d0-89f3-63885cfb3495

        :expectedresults: Partition Table is created and has correct content

        :CaseImportance: Critical
        """
        content = 'Fake ptable'
        ptable = make_partition_table({'content': content})
        ptable_content = PartitionTable().dump({'id': ptable['id']})
        self.assertTrue(content in ptable_content[0])
コード例 #25
0
    def test_positive_create_with_content_length(self):
        """Create a Partition Table with content length more than 4096 chars

        :id: 59e6f9ef-85c2-4229-8831-00edb41b19f4

        :expectedresults: Partition Table is created and has correct content

        :BZ: 1270181
        """
        content = gen_string('alpha', 5000)
        ptable = make_partition_table({'content': content})
        ptable_content = PartitionTable().dump({'id': ptable['id']})
        assert content in ptable_content[0]
コード例 #26
0
    def test_delete_ptable_1(self):
        """@Test: Check if Partition Table can be deleted

        @Feature: Partition Table - Delete

        @Assert: Partition Table is deleted

        """

        content = "Fake ptable"
        name = gen_alphanumeric(6)
        make_partition_table({'name': name, 'content': content})

        ptable = PartitionTable().exists(search=('name', name)).stdout

        args = {'id': ptable['id']}

        result = PartitionTable().delete(args)
        self.assertEqual(result.return_code, 0, "Deletion Failed")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")
        self.assertFalse(PartitionTable().exists(search=('name', name)).stdout)
コード例 #27
0
    def test_removeoperatingsystem_ptable(self):
        """@Test: Check if associated operating system can be removed

        @Feature: Partition Table - Add operating system

        @Assert: Operating system removed

        """
        content = gen_string("alpha", 10)
        name = gen_string("alpha", 10)
        try:
            ptable = make_partition_table({'name': name, 'content': content})
            os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        args = {
            'id': ptable['id'],
            'operatingsystem-id': os['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")

        result = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'],
                      result.stdout['operating-systems'])

        result = PartitionTable.remove_operating_system(args)
        self.assertEqual(result.return_code, 0, "Association Failed")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        result = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(
            os['title'],
            result.stdout['operating-systems'])
コード例 #28
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")
コード例 #29
0
    def test_removeoperatingsystem_ptable(self):
        """@Test: Check if associated operating system can be removed

        @Feature: Partition Table - Add operating system

        @Assert: Operating system removed

        """
        content = gen_string("alpha", 10)
        name = gen_string("alpha", 10)
        try:
            ptable = make_partition_table({'name': name, 'content': content})
            os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        args = {
            'id': ptable['id'],
            'operatingsystem-id': os['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")

        result = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'], result.stdout['operating-systems'])

        result = PartitionTable.remove_operating_system(args)
        self.assertEqual(result.return_code, 0, "Association Failed")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        result = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(os['title'], result.stdout['operating-systems'])
コード例 #30
0
    def test_create_ptable(self):
        """@Test: Check if Partition Table can be created

        @Assert: Partition Table is created

        @Feature: Partition Table - Create

        """

        try:
            make_partition_table(self.args)
        except CLIFactoryError as err:
            self.fail(err)
        result = PartitionTable().exists(search=('name', self.name))
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")
コード例 #31
0
    def test_positive_crud_with_name(self, name, new_name):
        """Create, read, update and delete Partition Tables with different names

        :id: ce512fef-fbf2-4365-b70b-d30221111d96

        :expectedresults: Partition Table is created, updated and deleted with correct name

        :parametrized: yes

        :CaseImportance: Critical
        """
        ptable = make_partition_table({'name': name})
        assert ptable['name'] == name
        PartitionTable.update({'id': ptable['id'], 'new-name': new_name})
        ptable = PartitionTable.info({'id': ptable['id']})
        assert ptable['name'] == new_name
        PartitionTable.delete({'name': ptable['name']})
        with pytest.raises(CLIReturnCodeError):
            PartitionTable.info({'name': ptable['name']})
コード例 #32
0
    def test_positive_add_remove_os_by_id(self):
        """Create a partition table then add and remove an operating system to it using
        IDs for association

        :id: 33b5ddca-2151-45cb-bf30-951c2733165f

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({'id': ptable['id'], 'operatingsystem-id': os['id']})
        ptable = PartitionTable.info({'id': ptable['id']})
        assert os['title'] in ptable['operating-systems']
        PartitionTable.remove_operating_system({'id': ptable['id'], 'operatingsystem-id': os['id']})
        ptable = PartitionTable.info({'id': ptable['id']})
        assert os['title'] not in ptable['operating-systems']
コード例 #33
0
ファイル: test_os.py プロジェクト: oshtaier/robottelo
    def test_add_ptable(self):
        """@test: Add ptable to os

        @feature: Operating System - Add ptable

        @assert: Operating System is updated with ptable

        """
        # Create a partition table.
        ptable_name = make_partition_table()['name']
        response = PartitionTable.info({'name': ptable_name})
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Create an operating system.
        os_id = make_os()['id']
        response = OperatingSys.info({'id': os_id})
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Add the partition table to the operating system.
        response = OperatingSys.add_ptable({
            'id': os_id,
            'partition-table': ptable_name,
        })
        self.assertEqual(response.return_code, 0, response.stderr)
        self.assertEqual(len(response.stderr), 0, response.stderr)

        # Verify that the operating system has a partition table.
        response = OperatingSys.info({'id': os_id})
        self.assertEqual(
            len(response.stdout['partition-tables']),
            1,
            response.stdout['partition-tables']
        )
        self.assertEqual(response.stdout['partition-tables'][0], ptable_name)
コード例 #34
0
    def test_positive_remove_os_by_id(self):
        """Add an operating system to a partition table then remove it. Use IDs
        for removal

        :id: ee37be42-9ed3-44dd-9206-514e340e5524

        :expectedresults: Operating system is added then removed from partition
            table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({'id': ptable['id'], 'operatingsystem-id': os['id']})
        ptable = PartitionTable.info({'id': ptable['id']})
        PartitionTable.remove_operating_system(
            {'id': ptable['id'], 'operatingsystem-id': os['id']}
        )
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #35
0
    def test_positive_remove_os_by_id(self):
        """Add an operating system to a partition table then remove it

        @Feature: Partition Table

        @Assert: Operating system is added then removed from partition table
        """
        ptable = make_partition_table({'content': gen_string("alpha", 10)})
        os = make_os()
        PartitionTable.add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'], ptable['operating-systems'])
        PartitionTable.remove_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #36
0
    def test_positive_remove_os_by_name(self):
        """Add an operating system to a partition table then remove it. Use
        names for removal

        @Feature: Partition Table

        @Assert: Operating system is added then removed from partition table
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        PartitionTable.remove_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #37
0
    def test_remove_os_ptable(self):
        """@Test: Check if associated operating system can be removed

        @Feature: Partition Table - Add operating system

        @Assert: Operating system removed

        """
        ptable = make_partition_table({'content': gen_string("alpha", 10)})
        os = make_os()
        PartitionTable.add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertIn(os['title'], ptable['operating-systems'])
        PartitionTable.remove_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #38
0
    def test_positive_remove_os_by_name(self):
        """Add an operating system to a partition table then remove it. Use
        names for removal

        :id: f7544419-af4c-4dcf-8673-cad472745794

        :expectedresults: Operating system is added then removed from partition
            table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system(
            {'name': ptable['name'], 'operatingsystem': os['title']}
        )
        ptable = PartitionTable.info({'name': ptable['name']})
        PartitionTable.remove_operating_system(
            {'name': ptable['name'], 'operatingsystem': os['title']}
        )
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #39
0
    def test_positive_add_remove_os_by_name(self):
        """Create a partition table then add and remove an operating system to it using
        names for association

        :id: 99185fce-fb26-4019-845c-3e5db9afd714

        :expectedresults: Operating system is added to partition table

        :CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system(
            {'name': ptable['name'], 'operatingsystem': os['title']}
        )
        ptable = PartitionTable.info({'name': ptable['name']})
        assert os['title'] in ptable['operating-systems']
        PartitionTable.remove_operating_system(
            {'name': ptable['name'], 'operatingsystem': os['title']}
        )
        ptable = PartitionTable.info({'name': ptable['name']})
        assert os['title'] not in ptable['operating-systems']
コード例 #40
0
    def test_positive_remove_os_by_name(self):
        """Add an operating system to a partition table then remove it. Use
        names for removal

        @id: f7544419-af4c-4dcf-8673-cad472745794

        @Assert: Operating system is added then removed from partition table

        @CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        PartitionTable.remove_operating_system({
            'name': ptable['name'],
            'operatingsystem': os['title'],
        })
        ptable = PartitionTable.info({'name': ptable['name']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #41
0
    def test_positive_remove_os_by_id(self):
        """Add an operating system to a partition table then remove it. Use IDs
        for removal

        @id: ee37be42-9ed3-44dd-9206-514e340e5524

        @Assert: Operating system is added then removed from partition table

        @CaseLevel: Integration
        """
        ptable = make_partition_table()
        os = make_os()
        PartitionTable.add_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        PartitionTable.remove_operating_system({
            'id': ptable['id'],
            'operatingsystem-id': os['id'],
        })
        ptable = PartitionTable.info({'id': ptable['id']})
        self.assertNotIn(os['title'], ptable['operating-systems'])
コード例 #42
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']
        )
コード例 #43
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'])