コード例 #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_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)
コード例 #3
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])
コード例 #4
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])
コード例 #5
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])
コード例 #6
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])
コード例 #7
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]
コード例 #8
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)
コード例 #9
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")
コード例 #10
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")