Ejemplo n.º 1
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")
Ejemplo n.º 2
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(tuple_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 = generate_name(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(tuple_search=('new-name', nw_nm)).stdout)
Ejemplo n.º 3
0
    def test_delete_medium_1(self):
        """Creates and immediately deletes partition table."""

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

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

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

        PartitionTable().delete(args)
        self.assertFalse(PartitionTable().exists(('name', name)).stdout)
Ejemplo n.º 4
0
    def test_create_ptable(self):
        """
        @Feature: Partition Table - Create
        @Test: Check if Partition Table can be created
        @Assert: Partition Table is created
        """

        try:
            make_partition_table(self.args)
        except CLIFactoryError as err:
            self.fail(err)
        result = PartitionTable().exists(tuple_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")
Ejemplo n.º 5
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']
        # Create an operating system.
        os_id = make_os()['id']

        # 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)
        self.assertEqual(len(response.stderr), 0)

        # Verify that the operating system has a partition table.
        response = OperatingSys.info({'id': os_id})
        self.assertEqual(len(response.stdout['partition-tables']), 1)
        self.assertEqual(response.stdout['partition-tables'][0], ptable_name)
Ejemplo n.º 6
0
    def test_bugzilla_1203457(self):
        """@test: Create an OS pointing to an arch, medium and partition table.

        @feature: Operating System - Create

        @assert: An operating system is created.

        @bz: 1203457, 1200116

        """
        architecture = make_architecture()
        medium = make_medium()
        ptable = make_partition_table()
        operating_system = make_os({
            u'architecture-ids': architecture['id'],
            u'medium-ids': medium['id'],
            u'partition-table-ids': ptable['id'],
        })

        for attr in (
                'architectures', 'installation-media', 'partition-tables'):
            self.assertEqual(len(operating_system[attr]), 1)
        self.assertEqual(
            operating_system['architectures'][0], architecture['name'])
        self.assertEqual(
            operating_system['installation-media'][0], medium['name'])
        self.assertEqual(
            operating_system['partition-tables'][0], ptable['name'])
Ejemplo n.º 7
0
    def test_positive_create_with_arch_medium_ptable(self):
        """Create an OS pointing to an arch, medium and partition table.

        :id: 05bdb2c6-0d2e-4141-9e07-3ada3933b577

        :expectedresults: An operating system is created.

        :CaseImportance: Critical
        """
        architecture = make_architecture()
        medium = make_medium()
        ptable = make_partition_table()
        operating_system = make_os(
            {
                'architecture-ids': architecture['id'],
                'medium-ids': medium['id'],
                'partition-table-ids': ptable['id'],
            }
        )

        for attr in ('architectures', 'installation-media', 'partition-tables'):
            assert len(operating_system[attr]) == 1
        assert operating_system['architectures'][0] == architecture['name']
        assert operating_system['installation-media'][0] == medium['name']
        assert operating_system['partition-tables'][0] == ptable['name']
Ejemplo n.º 8
0
    def test_bugzilla_1203457(self):
        """@test: Create an OS pointing to an arch, medium and partition table.

        @feature: Operating System - Create

        @assert: An operating system is created.

        """
        architecture = make_architecture()
        medium = make_medium()
        ptable = make_partition_table()
        operating_system = make_os({
            u'architecture-ids': architecture['id'],
            u'medium-ids': medium['id'],
            u'partition-table-ids': ptable['id'],
        })

        result = OperatingSys.info({'id': operating_system['id']})
        self.assertEqual(result.return_code, 0)
        stdout = result.stdout
        for attr in (
                'architectures', 'installation-media', 'partition-tables'):
            self.assertEqual(len(stdout[attr]), 1)
        self.assertEqual(stdout['architectures'][0], architecture['name'])
        self.assertEqual(stdout['installation-media'][0], medium['name'])
        self.assertEqual(stdout['partition-tables'][0], ptable['name'])
Ejemplo n.º 9
0
    def test_positive_create_with_arch_medium_ptable(self):
        """Create an OS pointing to an arch, medium and partition table.

        @id: 05bdb2c6-0d2e-4141-9e07-3ada3933b577

        @assert: An operating system is created.
        """
        architecture = make_architecture()
        medium = make_medium()
        ptable = make_partition_table()
        operating_system = make_os({
            u'architecture-ids': architecture['id'],
            u'medium-ids': medium['id'],
            u'partition-table-ids': ptable['id'],
        })

        for attr in ('architectures', 'installation-media',
                     'partition-tables'):
            self.assertEqual(len(operating_system[attr]), 1)
        self.assertEqual(operating_system['architectures'][0],
                         architecture['name'])
        self.assertEqual(operating_system['installation-media'][0],
                         medium['name'])
        self.assertEqual(operating_system['partition-tables'][0],
                         ptable['name'])
Ejemplo n.º 10
0
    def test_dump_ptable_1(self):
        """Creates partition table with specific content."""

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

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

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

        ptable_content = PartitionTable().dump(args)

        self.assertTrue(content in ptable_content.stdout[0])
Ejemplo n.º 11
0
    def test_positive_create_with_arch_medium_ptable(self):
        """Create an OS pointing to an arch, medium and partition table.

        @id: 05bdb2c6-0d2e-4141-9e07-3ada3933b577

        @assert: An operating system is created.
        """
        architecture = make_architecture()
        medium = make_medium()
        ptable = make_partition_table()
        operating_system = make_os({
            u'architecture-ids': architecture['id'],
            u'medium-ids': medium['id'],
            u'partition-table-ids': ptable['id'],
        })

        for attr in (
                'architectures', 'installation-media', 'partition-tables'):
            self.assertEqual(len(operating_system[attr]), 1)
        self.assertEqual(
            operating_system['architectures'][0], architecture['name'])
        self.assertEqual(
            operating_system['installation-media'][0], medium['name'])
        self.assertEqual(
            operating_system['partition-tables'][0], ptable['name'])
Ejemplo n.º 12
0
    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])
Ejemplo n.º 13
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)
Ejemplo n.º 14
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")
Ejemplo n.º 15
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])
Ejemplo n.º 16
0
    def test_positive_create_with_name_content(self):
        """Create a Partition Table with name and content

        @Assert: Partition Table is created and has correct name and content

        @Feature: Partition Table
        """
        ptable = make_partition_table(self.args)
        self.assertEqual(ptable['name'], self.name)
Ejemplo n.º 17
0
    def test_create_ptable(self):
        """@Test: Check if Partition Table can be created

        @Assert: Partition Table is created

        @Feature: Partition Table - Create

        """
        ptable = make_partition_table(self.args)
        self.assertEqual(ptable['name'], self.name)
Ejemplo n.º 18
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(('name', name)).stdout

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

        PartitionTable().delete(args)
        self.assertFalse(PartitionTable().exists(('name', name)).stdout)
Ejemplo n.º 19
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']})
Ejemplo n.º 20
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])
Ejemplo n.º 21
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']})
Ejemplo n.º 22
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']})
Ejemplo n.º 23
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])
Ejemplo n.º 24
0
    def test_positive_create_with_name(self):
        """Create Partition Tables with different names

        @id: e7d8a444-c69a-4863-a715-83d2dcb3b6ec

        @Assert: Partition Table is created and has correct name
        """
        for name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 25
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']})
Ejemplo n.º 26
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])
Ejemplo n.º 27
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])
Ejemplo n.º 28
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)
Ejemplo n.º 29
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']})
Ejemplo n.º 30
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])
Ejemplo n.º 31
0
    def test_positive_create_with_name(self):
        """Create Partition Tables with different names

        @id: e7d8a444-c69a-4863-a715-83d2dcb3b6ec

        @Assert: Partition Table is created and has correct name
        """
        for name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 32
0
    def test_positive_create_with_name(self):
        """Create Partition Tables with different names

        @Assert: Partition Table is created and has correct name

        @Feature: Partition Table
        """
        for name in generate_strings_list(length=randint(4, 30)):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 33
0
    def test_positive_delete_by_id(self):
        """Create a Partition Table then delete it by its ID

        @Feature: Partition Table

        @Assert: Partition Table is deleted
        """
        content = "Fake ptable"
        name = gen_alphanumeric(6)
        ptable = make_partition_table({'name': name, 'content': content})
        PartitionTable().delete({'id': ptable['id']})
        self.assertFalse(PartitionTable().exists(search=('name', name)))
Ejemplo n.º 34
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']}

        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(tuple_search=('name', name)).stdout)
Ejemplo n.º 35
0
    def test_dump_ptable_1(self):
        """@Test: Check if Partition Table can be created with specific content

        @Feature: Partition Table - Create

        @Assert: Partition Table is created

        """
        content = "Fake ptable"
        ptable = make_partition_table({'content': content})
        ptable_content = PartitionTable().dump({'id': ptable['id']})
        self.assertTrue(content in ptable_content[0])
Ejemplo n.º 36
0
    def test_positive_create_with_one_character_name(self):
        """Create Partition table with 1 character in name

        @Assert: Partition table was created

        @Feature: Partition Table - Create

        @BZ: 1229384
        """
        for name in generate_strings_list(length=1):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 37
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)
Ejemplo n.º 38
0
    def test_positive_create_with_one_character_name(self):
        """Create Partition table with 1 character in name

        @id: cfec857c-ed6e-4472-93bb-70e1d4f39bae

        @Assert: Partition table was created

        @BZ: 1229384
        """
        for name in generate_strings_list(length=1):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 39
0
    def test_positive_create_with_one_character_name(self):
        """Create Partition table with 1 character in name

        @id: cfec857c-ed6e-4472-93bb-70e1d4f39bae

        @Assert: Partition table was created

        @BZ: 1229384
        """
        for name in generate_strings_list(length=1):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 40
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])
Ejemplo n.º 41
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])
Ejemplo n.º 42
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']})
Ejemplo n.º 43
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']})
Ejemplo n.º 44
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]
Ejemplo n.º 45
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']})
        self.assertTrue(content in ptable_content[0])
Ejemplo n.º 46
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']})
Ejemplo n.º 47
0
    def test_positive_generate_report_sanitized(self):
        """Generate report template where there are values in comma outputted
        which might brake CSV format

        :id: 84b577db-144e-4961-a42e-e93887464986

        :setup: User with reporting access rights, Host Statuses report,
                a host with OS that has comma in its name

        :steps:

            1. hammer report-template generate ...

        :expectedresults: Report is generated in proper CSV format (value with comma is quoted)

        :CaseImportance: Medium
        """
        os_name = gen_string('alpha') + "," + gen_string('alpha')
        architecture = make_architecture()
        partition_table = make_partition_table()
        medium = make_medium()
        os = make_os({
            'name': os_name,
            'architecture-ids': architecture['id'],
            'medium-ids': medium['id'],
            'partition-table-ids': partition_table['id'],
        })

        host_name = gen_string('alpha')
        host = make_fake_host({
            'name': host_name,
            'architecture-id': architecture['id'],
            'medium-id': medium['id'],
            'operatingsystem-id': os['id'],
            'partition-table-id': partition_table['id']
        })

        report_template = make_report_template({
            'content': REPORT_TEMPLATE_FILE,
        })

        result = ReportTemplate.generate({
            'name': report_template['name'],
        })
        self.assertIn('Name,Operating System',
                      result)  # verify header of custom template
        self.assertIn(
            '{0},"{1}"'.format(host['name'],
                               host['operating-system']['operating-system']),
            result)
Ejemplo n.º 48
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")
Ejemplo n.º 49
0
    def test_positive_create_1(self):
        """@test: A host can be created with a random name

        @feature: Hosts

        @assert: A host is created and the name matches

        """
        # Use the default installation smart proxy
        result = Proxy.list()
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertGreater(len(result.stdout), 0)
        puppet_proxy = result.stdout[0]

        host_name = gen_string(str_type='alpha', length=gen_integer(1, 10))

        try:
            # Creating dependent objects
            architecture = make_architecture()
            domain = make_domain()
            environment = make_environment()
            location = make_location()
            medium = make_medium()
            ptable = make_partition_table()
            organization = make_org(cached=True)
            os = make_os({
                u'architecture-ids': architecture['id'],
                u'medium-ids': medium['id'],
                u'partition-table-ids': ptable['id'],
            })

            host = make_host({
                u'architecture-id': architecture['id'],
                u'domain-id': domain['id'],
                u'environment-id': environment['id'],
                u'location-id': location['id'],
                u'medium-id': medium['id'],
                u'name': host_name,
                u'operatingsystem-id': os['id'],
                u'organization-id': organization['id'],
                u'partition-table-id': ptable['id'],
                u'puppet-proxy-id': puppet_proxy['id'],
            })
        except CLIFactoryError as err:
            self.fail(err)

        name = '{0}.{1}'.format(host_name, domain['name']).lower()
        self.assertEqual(host['name'], name)
Ejemplo n.º 50
0
    def test_positive_create_with_one_character_name(self):
        """Create Partition table with 1 character in name

        :id: cfec857c-ed6e-4472-93bb-70e1d4f39bae

        :expectedresults: Partition table was created

        :BZ: 1229384

        :CaseImportance: Critical
        """
        for name in generate_strings_list(length=1):
            with self.subTest(name):
                ptable = make_partition_table({'name': name})
                self.assertEqual(ptable['name'], name)
Ejemplo n.º 51
0
    def test_positive_create_with_one_character_name(self, name):
        """Create Partition table with 1 character in name

        :id: cfec857c-ed6e-4472-93bb-70e1d4f39bae

        :parametrized: yes

        :expectedresults: Partition table was created

        :BZ: 1229384

        :CaseImportance: Medium
        """
        ptable = make_partition_table({'name': name})
        assert ptable['name'] == name
Ejemplo n.º 52
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'])
Ejemplo n.º 53
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)
Ejemplo n.º 54
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)
Ejemplo n.º 55
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'])
Ejemplo n.º 56
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'])
Ejemplo n.º 57
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']