Ejemplo n.º 1
0
    def test_add_architecture(self):
        """@test: Add Architecture to os

        @feature: Operating System - Add architecture

        @assert: Operating System is updated with architecture

        """

        a_ob = make_architecture()

        result = Architecture.info({'id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        new_obj = make_os()
        result = OperatingSys.add_architecture({
            'id': new_obj['id'],
            'architecture-id': a_ob['id']
        })
        self.assertEqual(result.return_code, 0, "Failed to add architecture")
        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['architectures']), 1)
        self.assertEqual(a_ob['name'], result.stdout['architectures'][0])
Ejemplo n.º 2
0
    def test_positive_update_arch_by_name(self):
        """A host can be updated with a new architecture. Use entities
        names for association

        @feature: Hosts

        @assert: A host is updated and the architecture matches
        """
        new_arch = make_architecture({
            'location':
            self.host_args.location.name,
            'organization':
            self.host_args.organization.name,
        })
        OperatingSys.add_architecture({
            'architecture':
            new_arch['name'],
            'title':
            self.host_args.operatingsystem.title,
        })
        Host.update({
            'architecture': new_arch['name'],
            'name': self.host['name'],
        })
        self.host = Host.info({'name': self.host['name']})
        self.assertEqual(self.host['architecture'], new_arch['name'])
Ejemplo n.º 3
0
    def test_add_configtemplate(self):
        """@test: Add configtemplate to os

        @feature: Operating System - Add comfigtemplate

        @assert: Operating System is updated with config template

        """

        conf_obj = make_template()

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

        new_obj = make_os()
        result = OperatingSys.add_config_template(
            {'id': new_obj['id'],
             'config-template': conf_obj['name']})
        self.assertEqual(result.return_code, 0, "Failed to add configtemplate")
        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['templates']), 1)
        template_name = result.stdout['templates'][0]
        self.assertTrue(template_name.startswith(conf_obj['name']))
Ejemplo n.º 4
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.º 5
0
    def test_positive_update_arch_by_id(self):
        """A host can be updated with a new architecture. Use entities
        ids for association

        @id: a4546fd6-997a-44e4-853a-eac235ea87b0

        @assert: A host is updated and the architecture matches

        @CaseLevel: Integration
        """
        new_arch = make_architecture({
            'location-id':
            self.host_args.location.id,
            'organization-id':
            self.host_args.organization.id,
        })
        OperatingSys.add_architecture({
            'architecture-id': new_arch['id'],
            'id': self.host_args.operatingsystem.id,
        })
        Host.update({
            'architecture-id': new_arch['id'],
            'id': self.host['id'],
        })
        self.host = Host.info({'id': self.host['id']})
        self.assertEqual(self.host['operating-system']['architecture'],
                         new_arch['name'])
Ejemplo n.º 6
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.º 7
0
    def test_negative_delete_1(self, test_data):
        """@test: Not delete Operating System for invalid data

        @feature: Operating System - Negative Delete

        @assert: Operating System is not deleted

        """

        # Create a new object using default values
        new_obj = make_os()

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        # The delete method requires the ID which we will not pass
        result = OperatingSys.delete(test_data)
        self.assertNotEqual(result.return_code, 0, "Should not delete object")
        self.assertGreater(len(result.stderr), 0,
                           "Should have gotten an error")

        # Now make sure that it still exists
        result = OperatingSys.info({'id': new_obj['id']})
        self.assertTrue(result.return_code == 0, "Failed to find object")
        self.assertEqual(new_obj['id'], result.stdout['id'])
        self.assertEqual(new_obj['name'], result.stdout['name'])
Ejemplo n.º 8
0
    def test_positive_update_arch_by_id(self):
        """A host can be updated with a new architecture. Use entities
        ids for association

        @id: a4546fd6-997a-44e4-853a-eac235ea87b0

        @assert: A host is updated and the architecture matches

        @CaseLevel: Integration
        """
        new_arch = make_architecture({
            'location-id': self.host_args.location.id,
            'organization-id': self.host_args.organization.id,
        })
        OperatingSys.add_architecture({
            'architecture-id': new_arch['id'],
            'id': self.host_args.operatingsystem.id,
        })
        Host.update({
            'architecture-id': new_arch['id'],
            'id': self.host['id'],
        })
        self.host = Host.info({'id': self.host['id']})
        self.assertEqual(
            self.host['operating-system']['architecture'], new_arch['name'])
Ejemplo n.º 9
0
    def test_bugzilla_1051557(self):
        """@test: Update an Operating System's major version.

        @feature: Operating System - Update

        @assert: Operating System major version is updated

        """

        try:
            os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        # New value for major
        major = int(os['major-version']) + 1

        result = OperatingSys.update({'id': os['id'], 'major': major})
        self.assertEqual(result.return_code, 0,
                         'Failed to update activation key')
        self.assertEqual(len(result.stderr), 0,
                         'There should not be an error here')

        result = OperatingSys.info({
            u'id': os['id'],
        })
        self.assertEqual(result.return_code, 0, 'Failed to get info for OS')
        self.assertEqual(len(result.stderr), 0,
                         'There should not be an error here')
        self.assertEqual(int(result.stdout['major-version']), major,
                         'OS major version was not updated')
Ejemplo n.º 10
0
    def test_positive_delete_1(self, test_data):
        """@test: Successfully deletes Operating System

        @feature: Operating System - Positive Delete

        @assert: Operating System is deleted

        """

        # Create a new object passing @test_data to factory method
        new_obj = make_os(test_data)

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        # Now delete it...
        result = OperatingSys.delete({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to delete object")
        self.assertEqual(len(result.stderr), 0, "Should not get an error.")
        # ... and make sure it does not exist anymore
        result = OperatingSys.info({'id': new_obj['id']})
        self.assertNotEqual(result.return_code, 0,
                            "Return code should not be zero")
        self.assertGreater(len(result.stderr), 0,
                           "Should have gotten an error")
        self.assertEqual(result.stdout, {}, "Should not get any output")
Ejemplo n.º 11
0
    def test_negative_update_1(self, test_data):
        """@test: Negative update of system name

        @feature: Operating System - Negative Update

        @assert: Operating System is not updated

        """

        # "Unpacks" values from tuple
        orig_dict, updates_dict = test_data

        # Create a new object passing @test_data to factory method
        new_obj = make_os(orig_dict)

        # Update original data with new values
        updates_dict['id'] = new_obj['id']
        orig_dict.update(updates_dict)

        # Now update the Foreman object
        result = OperatingSys.update(orig_dict)
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)

        # OS should not have changed
        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(new_obj['name'], result.stdout['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

        """
        # 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.º 13
0
    def test_positive_update_arch_by_name(self):
        """A host can be updated with a new architecture. Use entities
        names for association

        @id: 92da3782-47db-4701-aaab-3ea974043d20

        @assert: A host is updated and the architecture matches

        @CaseLevel: Integration
        """
        new_arch = make_architecture({
            'location':
            self.host_args.location.name,
            'organization':
            self.host_args.organization.name,
        })
        OperatingSys.add_architecture({
            'architecture':
            new_arch['name'],
            'title':
            self.host_args.operatingsystem.title,
        })
        Host.update({
            'architecture': new_arch['name'],
            'name': self.host['name'],
        })
        self.host = Host.info({'name': self.host['name']})
        self.assertEqual(self.host['operating-system']['architecture'],
                         new_arch['name'])
    def test_positive_os_list_with_default_organization_set(self):
        """list operating systems when the default organization is set

        :id: 2c1ba416-a5d5-4031-b154-54794569a85b

        :BZ: 1649011

        :expectedresults: os list should list operating systems when the
            default organization is set
        """
        make_os()
        os_list_before_default = OperatingSys.list()
        self.assertTrue(len(os_list_before_default) > 0)
        try:
            Defaults.add({'param-name': 'organization', 'param-value': DEFAULT_ORG})
            result = ssh.command('hammer defaults list')
            self.assertEqual(result.return_code, 0)
            self.assertTrue(DEFAULT_ORG in "".join(result.stdout))
            os_list_after_default = OperatingSys.list()
            self.assertTrue(len(os_list_after_default) > 0)

        finally:
            Defaults.delete({'param-name': 'organization'})
            result = ssh.command('hammer defaults list')
            self.assertEqual(result.return_code, 0)
            self.assertTrue(DEFAULT_ORG not in "".join(result.stdout))
Ejemplo n.º 15
0
    def test_bugzilla_1051557(self):
        """@test: Update an Operating System's major version.

        @feature: Operating System - Update

        @assert: Operating System major version is updated

        @bz: 1021557

        """

        try:
            os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        # New value for major
        major = int(os['major-version']) + 1

        result = OperatingSys.update(
            {'id': os['id'], 'major': major})
        self.assertEqual(result.return_code, 0,
                         'Failed to update activation key')
        self.assertEqual(len(result.stderr), 0,
                         'There should not be an error here')

        result = OperatingSys.info({
            u'id': os['id'],
        })
        self.assertEqual(result.return_code, 0,
                         'Failed to get info for OS')
        self.assertEqual(len(result.stderr), 0,
                         'There should not be an error here')
        self.assertEqual(int(result.stdout['major-version']), major,
                         'OS major version was not updated')
Ejemplo n.º 16
0
    def test_positive_update_1(self, test_data):
        """
        @test: Positive update of system name
        @feature: Operating System - Positive Update
        @assert: Operating System is updated and can be found
        """

        # "Unpacks" values from tuple
        orig_dict, updates_dict = test_data

        # Create a new object passing @test_data to factory method
        new_obj = make_os(orig_dict)

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        # Update original test_data with new values
        updates_dict['id'] = new_obj['id']
        orig_dict.update(updates_dict)
        # Now update the Foreman object
        result = OperatingSys.update(orig_dict)
        self.assertEqual(result.return_code, 0, "Failed to update object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        result = OperatingSys.info({'id': new_obj['id']})

        # Verify that standard values are correct
        self.assertEqual(
            new_obj['id'], result.stdout['id'], "IDs should match")
        self.assertNotEqual(result.stdout['name'], new_obj['name'])
        # There should be some attributes changed now
        self.assertNotEqual(new_obj, result.stdout, "Object should be updated")
Ejemplo n.º 17
0
    def test_positive_delete_1(self, test_data):
        """@test: Successfully deletes Operating System

        @feature: Operating System - Positive Delete

        @assert: Operating System is deleted

        """

        # Create a new object passing @test_data to factory method
        new_obj = make_os(test_data)

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        # Now delete it...
        result = OperatingSys.delete(
            {'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to delete object")
        self.assertEqual(len(result.stderr), 0, "Should not get an error.")
        # ... and make sure it does not exist anymore
        result = OperatingSys.info({'id': new_obj['id']})
        self.assertNotEqual(
            result.return_code, 0, "Return code should not be zero")
        self.assertGreater(
            len(result.stderr), 0, "Should have gotten an error")
        self.assertEqual(result.stdout, {}, "Should not get any output")
Ejemplo n.º 18
0
    def test_negative_delete_1(self, test_data):
        """@test: Not delete Operating System for invalid data

        @feature: Operating System - Negative Delete

        @assert: Operating System is not deleted

        """

        # Create a new object using default values
        new_obj = make_os()

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        # The delete method requires the ID which we will not pass
        result = OperatingSys.delete(test_data)
        self.assertNotEqual(result.return_code, 0, "Should not delete object")
        self.assertGreater(
            len(result.stderr), 0, "Should have gotten an error")

        # Now make sure that it still exists
        result = OperatingSys.info({'id': new_obj['id']})
        self.assertTrue(result.return_code == 0, "Failed to find object")
        self.assertEqual(new_obj['id'], result.stdout['id'])
        self.assertEqual(new_obj['name'], result.stdout['name'])
Ejemplo n.º 19
0
    def test_add_architecture(self):
        """@test: Add Architecture to os

        @feature: Operating System - Add architecture

        @assert: Operating System is updated with architecture

        """

        a_ob = make_architecture()

        result = Architecture.info({'id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        new_obj = make_os()
        result = OperatingSys.add_architecture({'id': new_obj['id'],
                                                'architecture-id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to add architecture")
        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['architectures']), 1)
        self.assertEqual(a_ob['name'], result.stdout['architectures'][0])
Ejemplo n.º 20
0
    def test_positive_update_arch_by_name(self):
        """A host can be updated with a new architecture. Use entities
        names for association

        @id: 92da3782-47db-4701-aaab-3ea974043d20

        @assert: A host is updated and the architecture matches

        @CaseLevel: Integration
        """
        new_arch = make_architecture({
            'location': self.host_args.location.name,
            'organization': self.host_args.organization.name,
        })
        OperatingSys.add_architecture({
            'architecture': new_arch['name'],
            'title': self.host_args.operatingsystem.title,
        })
        Host.update({
            'architecture': new_arch['name'],
            'name': self.host['name'],
        })
        self.host = Host.info({'name': self.host['name']})
        self.assertEqual(
            self.host['operating-system']['architecture'], new_arch['name'])
Ejemplo n.º 21
0
    def test_bugzilla_1051557(self):
        """@test: Update an Operating System's major version.

        @feature: Operating System - Update

        @assert: Operating System major version is updated

        """

        try:
            os = make_os()
        except CLIFactoryError as err:
            self.fail(err)

        # New value for major
        major = int(os['major-version']) + 1

        result = OperatingSys.update(
            {'id': os['id'], 'major': major})
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = OperatingSys.info({
            u'id': os['id'],
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
        self.assertEqual(int(result.stdout['major-version']), major)
Ejemplo n.º 22
0
    def test_add_configtemplate(self):
        """@test: Add configtemplate to os

        @feature: Operating System - Add comfigtemplate

        @assert: Operating System is updated with config template

        """

        conf_obj = make_template()

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

        new_obj = make_os()
        result = OperatingSys.add_config_template({
            'id':
            new_obj['id'],
            'config-template':
            conf_obj['name']
        })
        self.assertEqual(result.return_code, 0, "Failed to add configtemplate")
        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['templates']), 1)
        template_name = result.stdout['templates'][0]
        self.assertTrue(template_name.startswith(conf_obj['name']))
Ejemplo n.º 23
0
    def test_positive_delete_by_id(self):
        """Successfully deletes Operating System by its ID

        @id: a67a7b01-081b-42f8-a9ab-1f41166d649e

        @assert: Operating System is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                os = make_os({'name': name})
                OperatingSys.delete({'id': os['id']})
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.info({'id': os['id']})
Ejemplo n.º 24
0
    def test_positive_delete_by_id(self):
        """Successfully deletes Operating System by its ID

        @id: a67a7b01-081b-42f8-a9ab-1f41166d649e

        @assert: Operating System is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                os = make_os({'name': name})
                OperatingSys.delete({'id': os['id']})
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.info({'id': os['id']})
Ejemplo n.º 25
0
    def test_positive_delete_by_id(self):
        """@test: Successfully deletes Operating System by its ID

        @feature: Operating System

        @assert: Operating System is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                os = make_os({'name': name})
                OperatingSys.delete({'id': os['id']})
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.info({'id': os['id']})
Ejemplo n.º 26
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))
Ejemplo n.º 27
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))
Ejemplo n.º 28
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))
Ejemplo n.º 29
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))
Ejemplo n.º 30
0
    def test_positive_delete_by_id(self, name):
        """Successfully deletes Operating System by its ID

        :id: a67a7b01-081b-42f8-a9ab-1f41166d649e

        :parametrized: yes

        :expectedresults: Operating System is deleted

        :CaseImportance: Critical
        """
        os = make_os({'name': name})
        OperatingSys.delete({'id': os['id']})
        with pytest.raises(CLIReturnCodeError):
            OperatingSys.info({'id': os['id']})
Ejemplo n.º 31
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))
Ejemplo n.º 32
0
    def test_positive_update_major_version(self):
        """Update an Operating System's major version.

        :id: 38a89dbe-6d1c-4602-a4c1-664425668de8

        :expectedresults: Operating System major version is updated

        :CaseImportance: Critical
        """
        os = make_os()
        # New value for major
        major = int(os['major-version']) + 1
        OperatingSys.update({'id': os['id'], 'major': major})
        os = OperatingSys.info({'id': os['id']})
        assert int(os['major-version']) == major
Ejemplo n.º 33
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))
    def test_positive_add_arch(self):
        """Add Architecture to operating system

        :id: 99add22d-d936-4232-9441-beff85867040

        :expectedresults: Architecture is added to Operating System

        :CaseLevel: Integration
        """
        architecture = make_architecture()
        os = make_os()
        OperatingSys.add_architecture({'architecture-id': architecture['id'], 'id': os['id']})
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['architectures']), 1)
        self.assertEqual(architecture['name'], os['architectures'][0])
Ejemplo n.º 35
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))
Ejemplo n.º 36
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.º 37
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))
Ejemplo n.º 38
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))
Ejemplo n.º 39
0
    def test_positive_add_arch(self):
        """@test: Add Architecture to operating system

        @feature: Operating System

        @assert: Architecture is added to Operating System
        """
        architecture = make_architecture()
        os = make_os()
        OperatingSys.add_architecture({
            'architecture-id': architecture['id'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['architectures']), 1)
        self.assertEqual(architecture['name'], os['architectures'][0])
Ejemplo n.º 40
0
    def test_positive_add_arch(self):
        """Add Architecture to operating system

        @feature: Operating System

        @assert: Architecture is added to Operating System
        """
        architecture = make_architecture()
        os = make_os()
        OperatingSys.add_architecture({
            'architecture-id': architecture['id'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['architectures']), 1)
        self.assertEqual(architecture['name'], os['architectures'][0])
Ejemplo n.º 41
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")
    def test_positive_update_name(self):
        """Positive update of operating system name

        :id: 49b655f7-ba9b-4bb9-b09d-0f7140969a40

        :expectedresults: Operating System name is updated

        :CaseImportance: Critical
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in valid_data_list():
            with self.subTest(new_name):
                OperatingSys.update({'id': os['id'], 'name': new_name})
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['id'], os['id'])
                self.assertNotEqual(result['name'], os['name'])
Ejemplo n.º 43
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']})
        assert os['id'] == os_info['id']
        os_list_after = OperatingSys.list()
        assert len(os_list_after) > len(os_list_before)
Ejemplo n.º 44
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']})
        assert os['id'] == os_info['id']
        os_list_after = OperatingSys.list()
        assert len(os_list_after) > len(os_list_before)
    def test_negative_update_name(self):
        """Negative update of system name

        :id: 4b18ff6d-7728-4245-a1ce-38e62c05f454

        :expectedresults: Operating System name is not updated

        :CaseImportance: Critical
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.update({'id': os['id'], 'name': new_name})
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['name'], os['name'])
Ejemplo n.º 46
0
    def test_negative_update_name(self, new_name):
        """Negative update of system name

        :id: 4b18ff6d-7728-4245-a1ce-38e62c05f454

        :parametrized: yes

        :expectedresults: Operating System name is not updated

        :CaseImportance: Critical
        """
        os = make_os({'name': gen_alphanumeric()})
        with pytest.raises(CLIReturnCodeError):
            OperatingSys.update({'id': os['id'], 'name': new_name})
        result = OperatingSys.info({'id': os['id']})
        assert result['name'] == os['name']
Ejemplo n.º 47
0
    def test_positive_update_name(self, new_name):
        """Positive update of operating system name

        :id: 49b655f7-ba9b-4bb9-b09d-0f7140969a40

        :parametrized: yes

        :expectedresults: Operating System name is updated

        :CaseImportance: Critical
        """
        os = make_os({'name': gen_alphanumeric()})
        OperatingSys.update({'id': os['id'], 'name': new_name})
        result = OperatingSys.info({'id': os['id']})
        assert result['id'] == os['id']
        assert result['name'] != os['name']
Ejemplo n.º 48
0
    def test_negative_delete_by_id(self):
        """Delete Operating System using invalid data

        @feature: Operating System

        @assert: Operating System is not deleted
        """
        for test_data in NEGATIVE_DELETE_DATA:
            with self.subTest(test_data):
                os = make_os()
                # The delete method requires the ID which we will not pass
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.delete(test_data)
                # Now make sure that it still exists
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(os['id'], result['id'])
                self.assertEqual(os['name'], result['name'])
Ejemplo n.º 49
0
    def test_positive_add_template(self):
        """Add provisioning template to operating system

        @feature: Operating System

        @assert: Provisioning template is added to Operating System
        """
        template = make_template()
        os = make_os()
        OperatingSys.add_config_template({
            'config-template': template['name'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['templates']), 1)
        template_name = os['templates'][0]
        self.assertTrue(template_name.startswith(template['name']))
Ejemplo n.º 50
0
    def test_negative_delete_by_id(self):
        """Delete Operating System using invalid data

        @id: d29a9c95-1fe3-4a7a-9f7b-127be065856d

        @assert: Operating System is not deleted
        """
        for test_data in negative_delete_data():
            with self.subTest(test_data):
                os = make_os()
                # The delete method requires the ID which we will not pass
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.delete(test_data)
                # Now make sure that it still exists
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(os['id'], result['id'])
                self.assertEqual(os['name'], result['name'])
Ejemplo n.º 51
0
    def test_add_architecture(self):
        """@test: Add Architecture to os

        @feature: Operating System - Add architecture

        @assert: Operating System is updated with architecture

        """
        architecture = make_architecture()
        os = make_os()
        OperatingSys.add_architecture({
            'architecture-id': architecture['id'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['architectures']), 1)
        self.assertEqual(architecture['name'], os['architectures'][0])
Ejemplo n.º 52
0
    def test_negative_delete_by_id(self):
        """Delete Operating System using invalid data

        @id: d29a9c95-1fe3-4a7a-9f7b-127be065856d

        @assert: Operating System is not deleted
        """
        for test_data in negative_delete_data():
            with self.subTest(test_data):
                os = make_os()
                # The delete method requires the ID which we will not pass
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.delete(test_data)
                # Now make sure that it still exists
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(os['id'], result['id'])
                self.assertEqual(os['name'], result['name'])
Ejemplo n.º 53
0
    def test_positive_update_name(self):
        """@test: Positive update of operating system name

        @feature: Operating System

        @assert: Operating System name is updated
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in valid_data_list():
            with self.subTest(new_name):
                OperatingSys.update({
                    'id': os['id'],
                    'name': new_name,
                })
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['id'], os['id'], )
                self.assertNotEqual(result['name'], os['name'])
Ejemplo n.º 54
0
    def test_negative_delete_by_id(self):
        """@test: Delete Operating System using invalid data

        @feature: Operating System

        @assert: Operating System is not deleted
        """
        for test_data in NEGATIVE_DELETE_DATA:
            with self.subTest(test_data):
                os = make_os()
                # The delete method requires the ID which we will not pass
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.delete(test_data)
                # Now make sure that it still exists
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(os['id'], result['id'])
                self.assertEqual(os['name'], result['name'])
Ejemplo n.º 55
0
    def test_positive_add_template(self):
        """@test: Add provisioning template to operating system

        @feature: Operating System

        @assert: Provisioning template is added to Operating System
        """
        template = make_template()
        os = make_os()
        OperatingSys.add_config_template({
            'config-template': template['name'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['templates']), 1)
        template_name = os['templates'][0]
        self.assertTrue(template_name.startswith(template['name']))
Ejemplo n.º 56
0
    def test_negative_update_name(self):
        """Negative update of system name

        @feature: Operating System

        @assert: Operating System name is not updated
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.update({
                        'id': os['id'],
                        'name': new_name,
                    })
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['name'], os['name'])
Ejemplo n.º 57
0
    def test_positive_update_name(self):
        """Positive update of operating system name

        @id: 49b655f7-ba9b-4bb9-b09d-0f7140969a40

        @assert: Operating System name is updated
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in valid_data_list():
            with self.subTest(new_name):
                OperatingSys.update({
                    'id': os['id'],
                    'name': new_name,
                })
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['id'], os['id'], )
                self.assertNotEqual(result['name'], os['name'])
Ejemplo n.º 58
0
    def test_negative_update_name(self):
        """Negative update of system name

        @id: 4b18ff6d-7728-4245-a1ce-38e62c05f454

        @assert: Operating System name is not updated
        """
        os = make_os({'name': gen_alphanumeric()})
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    OperatingSys.update({
                        'id': os['id'],
                        'name': new_name,
                    })
                result = OperatingSys.info({'id': os['id']})
                self.assertEqual(result['name'], os['name'])
Ejemplo n.º 59
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)
Ejemplo n.º 60
0
    def test_positive_add_arch(self):
        """Add Architecture to operating system

        @id: 99add22d-d936-4232-9441-beff85867040

        @assert: Architecture is added to Operating System

        @CaseLevel: Integration
        """
        architecture = make_architecture()
        os = make_os()
        OperatingSys.add_architecture({
            'architecture-id': architecture['id'],
            'id': os['id'],
        })
        os = OperatingSys.info({'id': os['id']})
        self.assertEqual(len(os['architectures']), 1)
        self.assertEqual(architecture['name'], os['architectures'][0])