Exemple #1
0
    def test_positive_create_with_template(self):
        """Create an operating system that points at a config template.

        :id: df73ecba-5a1c-4201-9c2f-b2e03e8fec25

        :expectedresults: The operating system is created and points at the
            expected config template.

        :CaseLevel: Integration
        """
        template = entities.ConfigTemplate(organization=[self.org]).create()
        operating_sys = entities.OperatingSystem(config_template=[template]).create()
        self.assertEqual(len(operating_sys.config_template), 1)
        self.assertEqual(operating_sys.config_template[0].id, template.id)
    def test_negative_create_with_invalid_name(self):
        """Try to create operating system entity providing an invalid
        name

        :id: cd4286fd-7128-4385-9c8d-ef979c22ee38

        :expectedresults: Operating system entity is not created

        :CaseImportance: Critical
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(HTTPError):
                    entities.OperatingSystem(name=name).create()
    def test_negative_create_with_invalid_minor_version(self):
        """Try to create operating system entity providing incorrect
        minor version value (More than 16 characters and negative number)

        :id: dec4b456-153c-4a66-8b8e-b12ac7800e51

        :expectedresults: Operating system entity is not created

        :CaseImportance: Critical
        """
        for minor_version in gen_string('numeric', 17), '-5':
            with self.subTest(minor_version):
                with self.assertRaises(HTTPError):
                    entities.OperatingSystem(minor=minor_version).create()
    def test_positive_create_with_ptable(self):
        """Create an operating system that points at a partition table.

        :id: bef37ff9-d8fa-4518-9073-0518aa9f9a42

        :expectedresults: The operating system is created and points at the
            given partition table.

        :CaseLevel: Integration
        """
        ptable = entities.PartitionTable().create()
        operating_sys = entities.OperatingSystem(ptable=[ptable]).create()
        self.assertEqual(len(operating_sys.ptable), 1)
        self.assertEqual(operating_sys.ptable[0].id, ptable.id)
    def test_positive_create_with_media(self):
        """Create an operating system that points at a media.

        :id: 56fadee4-c676-48b6-a2db-e6fef9d2a575

        :expectedresults: The operating system is created and points at the
            given media.

        :CaseLevel: Integration
        """
        medium = entities.Media(organization=[self.org]).create()
        operating_sys = entities.OperatingSystem(medium=[medium]).create()
        self.assertEqual(len(operating_sys.medium), 1)
        self.assertEqual(operating_sys.medium[0].id, medium.id)
Exemple #6
0
def clone_setup(module_org, module_loc):
    name = gen_string('alpha')
    content = gen_string('alpha')
    os_list = [entities.OperatingSystem().create().title for _ in range(2)]
    return {
        'pt':
        entities.ProvisioningTemplate(name=name,
                                      organization=[module_org],
                                      location=[module_loc],
                                      template=content,
                                      snippet=False).create(),
        'os_list':
        os_list
    }
    def test_positive_create_with_arch(self):
        """Create an operating system that points at an architecture.

        :id: 6a3f7183-b0bf-4834-8c69-a49fe8d7ee5a

        :expectedresults: The operating system is created and points at the
            given architecture.

        :CaseLevel: Integration
        """
        arch = entities.Architecture().create()
        operating_sys = entities.OperatingSystem(architecture=[arch]).create()
        self.assertEqual(len(operating_sys.architecture), 1)
        self.assertEqual(operating_sys.architecture[0].id, arch.id)
    def test_negative_create_with_invalid_minor_version(self, minor_version):
        """Try to create operating system entity providing incorrect
        minor version value (More than 16 characters and negative number)

        :id: dec4b456-153c-4a66-8b8e-b12ac7800e51

        :parametrized: yes

        :expectedresults: Operating system entity is not created

        :CaseImportance: Critical
        """
        with pytest.raises(HTTPError):
            entities.OperatingSystem(minor=minor_version).create()
    def test_positive_create_with_name(self, name):
        """Create operating system with valid name only

        :id: e95707bf-3344-4d85-866f-4642a8f66cff

        :parametrized: yes

        :expectedresults: Operating system entity is created and has proper
            name

        :CaseImportance: Critical
        """
        os = entities.OperatingSystem(name=name).create()
        assert os.name == name
    def test_negative_create_with_invalid_name(self, name):
        """Try to create operating system entity providing an invalid
        name

        :id: cd4286fd-7128-4385-9c8d-ef979c22ee38

        :parametrized: yes

        :expectedresults: Operating system entity is not created

        :CaseImportance: Critical
        """
        with pytest.raises(HTTPError):
            entities.OperatingSystem(name=name).create()
    def test_negative_create_with_too_long_description(self):
        """Try to create operating system entity providing too long
        description value

        :id: fe5fc36a-5994-4d8a-91f6-0425765b8c39

        :expectedresults: Operating system entity is not created

        :BZ: 1328935

        :CaseImportance: Critical
        """
        with pytest.raises(HTTPError):
            entities.OperatingSystem(description=gen_string('alphanumeric', 256)).create()
    def test_positive_create_with_template(self, module_org):
        """Create an operating system that points at a provisioning template.

        :id: df73ecba-5a1c-4201-9c2f-b2e03e8fec25

        :expectedresults: The operating system is created and points at the
            expected provisioning template.

        :CaseLevel: Integration
        """
        template = entities.ProvisioningTemplate(organization=[module_org]).create()
        operating_sys = entities.OperatingSystem(provisioning_template=[template]).create()
        assert len(operating_sys.provisioning_template) == 1
        assert operating_sys.provisioning_template[0].id == template.id
    def test_positive_create_with_password_hash(self, pass_hash):
        """Create operating system with valid password hash option

        :id: 00830e71-b414-41ab-bc8f-03fd2fbd5a84

        :parametrized: yes

        :expectedresults: Operating system entity is created and has proper
            password hash type

        :CaseImportance: Critical
        """
        os = entities.OperatingSystem(password_hash=pass_hash).create()
        assert os.password_hash == pass_hash
    def test_positive_read_minor_version_as_string(self):
        """Create an operating system with an integer minor version.

        :id: b45e0b94-62f7-45ff-a19e-83c7a0f51339

        :expectedresults: The minor version can be read back as a string.

        :CaseImportance: Critical

        :BZ: 1230902
        """
        minor = int(gen_string('numeric', random.randint(1, 16)))
        operating_sys = entities.OperatingSystem(minor=minor).create()
        assert operating_sys.minor == str(minor)
Exemple #15
0
    def test_positive_media_read(self):
        """Create a media pointing at an OS and read the media.

        :id: 67b656fe-9302-457a-b544-3addb11c85e0

        :expectedresults: The media points at the correct operating system.

        :CaseImportance: Critical
        """
        os_id = entities.OperatingSystem().create_json()['id']
        media_id = entities.Media(operatingsystem=[os_id]).create_json()['id']
        media = entities.Media(id=media_id).read()
        self.assertEqual(len(media.operatingsystem), 1)
        self.assertEqual(media.operatingsystem[0].id, os_id)
    def test_positive_create_with_password_hash(self):
        """Create operating system with valid password hash option

        :id: 00830e71-b414-41ab-bc8f-03fd2fbd5a84

        :expectedresults: Operating system entity is created and has proper
            password hash type

        :CaseImportance: Critical
        """
        for pass_hash in ['SHA256', 'SHA512']:
            with self.subTest(pass_hash):
                os = entities.OperatingSystem(password_hash=pass_hash).create()
                self.assertEqual(os.password_hash, pass_hash)
Exemple #17
0
def test_positive_end_to_end(session, module_org, module_loc):
    """Perform end to end testing for host group component

    :id: 537d95f2-fe32-4e06-a2cb-21c80fe8e2e2

    :expectedresults: All expected CRUD actions finished successfully

    :CaseImportance: Critical
    """
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    description = gen_string('alpha')
    architecture = entities.Architecture().create()
    os = entities.OperatingSystem(architecture=[architecture]).create()
    os_name = f'{os.name} {os.major}'
    domain = entities.Domain(organization=[module_org],
                             location=[module_loc]).create()
    with session:
        # Create host group with some data
        session.hostgroup.create({
            'host_group.name':
            name,
            'host_group.description':
            description,
            'host_group.lce':
            ENVIRONMENT,
            'host_group.content_view':
            DEFAULT_CV,
            'network.domain':
            domain.name,
            'operating_system.architecture':
            architecture.name,
            'operating_system.operating_system':
            os_name,
        })
        hostgroup_values = session.hostgroup.read(name)
        assert hostgroup_values['host_group']['name'] == name
        assert hostgroup_values['host_group']['description'] == description
        assert hostgroup_values['host_group']['lce'] == ENVIRONMENT
        assert hostgroup_values['host_group']['content_view'] == DEFAULT_CV
        assert hostgroup_values['operating_system'][
            'architecture'] == architecture.name
        assert hostgroup_values['operating_system'][
            'operating_system'] == os_name
        # Update host group with new name
        session.hostgroup.update(name, {'host_group.name': new_name})
        assert session.hostgroup.search(new_name)[0]['Name'] == new_name
        # Delete host group
        session.hostgroup.delete(new_name)
        assert not session.hostgroup.search(new_name)
    def test_positive_create_with_name(self):
        """Create operating system with valid name only

        :id: e95707bf-3344-4d85-866f-4642a8f66cff

        :expectedresults: Operating system entity is created and has proper
            name

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                os = entities.OperatingSystem(name=name).create()
                self.assertEqual(os.name, name)
    def test_positive_create_with_os_family(self):
        """Create operating system with every OS family possible

        :id: 6ad32d22-53cc-4bab-ac10-f466f75d7cc6

        :expectedresults: Operating system entity is created and has proper OS
            family assigned

        :CaseImportance: Critical
        """
        for os_family in OPERATING_SYSTEMS:
            with self.subTest(os_family):
                os = entities.OperatingSystem(family=os_family).create()
                self.assertEqual(os.family, os_family)
Exemple #20
0
    def test_positive_sort_by_os(self):
        """Create some Host entities and sort them by operation system
        ascendingly and then descendingly

        :id: 617e812d-258e-4ba4-8a9a-d7d02f2fb405

        :customerscenario: true

        :expectedresults: Host entities are sorted properly

        :CaseImportance: High

        :BZ: 1268085

        :CaseLevel: Integration
        """
        org = entities.Organization().create()
        name_list = [gen_string('alpha', 20) for _ in range(5)]
        host = entities.Host(organization=org)
        host.create_missing()
        for name in name_list:
            os = entities.OperatingSystem(name=name).create()
            entities.Host(
                organization=org,
                architecture=host.architecture,
                domain=host.domain,
                environment=host.environment,
                location=host.location,
                mac=host.mac,
                medium=host.medium,
                operatingsystem=os,
                ptable=host.ptable,
                root_pass=host.root_pass,
            ).create()
        with Session(self) as session:
            set_context(session, org=org.name)
            self.hosts.navigate_to_entity()
            sorted_list_asc = self.hosts.sort_table_by_column(
                'Operating system')
            self.assertEqual(
                [el.split(' ', 1)[0] for el in sorted_list_asc],
                sorted(name_list, key=six.text_type.lower)
            )
            sorted_list_desc = self.hosts.sort_table_by_column(
                'Operating system')
            self.assertEqual(
                [el.split(' ', 1)[0] for el in sorted_list_desc],
                sorted(name_list, key=six.text_type.lower, reverse=True)
            )
    def test_positive_delete(self):
        """Create new operating system entity and then delete it.

        :id: 3dbffb56-ad99-441d-921c-0fad6504d257

        :expectedresults: Operating System entity is deleted successfully

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                os = entities.OperatingSystem(name=name).create()
                os.delete()
                with self.assertRaises(HTTPError):
                    os.read()
    def test_negative_create_with_invalid_major_version(self):
        """Try to create operating system entity providing incorrect
        major version value (More than 5 characters, empty value, negative
        number)

        :id: f2646bc2-d639-4079-bdcb-ff76679f1457

        :expectedresults: Operating system entity is not created

        :CaseImportance: Critical
        """
        for major_version in gen_string('numeric', 6), '', '-6':
            with self.subTest(major_version):
                with self.assertRaises(HTTPError):
                    entities.OperatingSystem(major=major_version).create()
Exemple #23
0
    def test_positive_create_with_os(self):
        """Create media entity assigned to operation system entity

        @id: dec22198-ed07-480c-9306-fa5458baec0b

        @Assert: Media entity is created and assigned to expected OS

        @CaseLevel: Integration
        """
        os = entities.OperatingSystem().create()
        media = entities.Media(
            organization=[self.org],
            operatingsystem=[os],
        ).create()
        self.assertEqual(os.read().medium[0].read().name, media.name)
    def test_positive_create_with_ptables(self):
        """Create an operating system that points at multiple different
        partition tables.

        @Feature: Operating System

        @Assert: The operating system is created and points at the expected
        partition tables.
        """
        amount = range(random.randint(3, 5))
        ptables = [entities.PartitionTable().create() for _ in amount]
        operating_sys = entities.OperatingSystem(ptable=ptables).create()
        self.assertEqual(len(operating_sys.ptable), len(amount))
        self.assertEqual(set([ptable.id for ptable in operating_sys.ptable]),
                         set([ptable.id for ptable in ptables]))
    def test_positive_architecture_read(self):
        """Create an arch that points to an OS, and read the arch.

        :id: e4c7babe-11d8-4f85-8382-5267a49046e9

        :expectedresults: The call to ``Architecture.read`` succeeds, and the
            response contains the correct operating system ID.

        :CaseImportance: Critical
        """
        os_id = entities.OperatingSystem().create_json()['id']
        arch_id = entities.Architecture(operatingsystem=[os_id]).create_json()['id']
        architecture = entities.Architecture(id=arch_id).read()
        self.assertEqual(len(architecture.operatingsystem), 1)
        self.assertEqual(architecture.operatingsystem[0].id, os_id)
    def test_positive_create_with_archs(self):
        """Create an operating system that points at multiple different
        architectures.

        @Feature: Operating System

        @Assert: The operating system is created and points at the expected
        architectures.
        """
        amount = range(random.randint(3, 5))
        archs = [entities.Architecture().create() for _ in amount]
        operating_sys = entities.OperatingSystem(architecture=archs).create()
        self.assertEqual(len(operating_sys.architecture), len(amount))
        self.assertEqual(set([arch.id for arch in operating_sys.architecture]),
                         set([arch.id for arch in archs]))
Exemple #27
0
    def test_positive_delete(self):
        """Delete an existing Architecture

        @Feature: Architecture - Delete

        @Assert: Architecture is deleted
        """
        os = entities.OperatingSystem(name=gen_string('alpha')).create()
        with Session(self.browser) as session:
            for name in generate_strings_list():
                with self.subTest(name):
                    entities.Architecture(
                        name=name, operatingsystem=[os]).create()
                    session.nav.go_to_architectures()
                    self.architecture.delete(name)
Exemple #28
0
    def test_positive_add_os(self):
        """Create an architecture and associate it with an OS.

        :id: 9943063d-34f3-4dbc-a341-474ec781e4d9

        :expectedresults: The architecture can be created, and the association
            can be read back from the server.

        :CaseLevel: Integration
        """
        operating_sys = entities.OperatingSystem().create()
        arch = entities.Architecture(operatingsystem=[operating_sys]).create()
        self.assertEqual({operating_sys.id},
                         {os.id
                          for os in arch.operatingsystem})
Exemple #29
0
    def test_positive_add_os(self):
        """Create an architecture and associate it with an OS.

        @Assert: The architecture can be created, and the association can be
        read back from the server.

        @Feature: Architecture
        """
        operating_sys = entities.OperatingSystem().create()
        arch = entities.Architecture(operatingsystem=[operating_sys]).create()
        self.assertEqual(
            {operating_sys.id},
            {os.id
             for os in arch.operatingsystem},
        )
    def test_positive_delete(self, name):
        """Create new operating system entity and then delete it.

        :id: 3dbffb56-ad99-441d-921c-0fad6504d257

        :parametrized: yes

        :expectedresults: Operating System entity is deleted successfully

        :CaseImportance: Critical
        """
        os = entities.OperatingSystem(name=name).create()
        os.delete()
        with pytest.raises(HTTPError):
            os.read()