Exemple #1
0
    def test_positive_update_url(self):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        :id: 997fd9f6-4809-4de8-869d-7a4a0bf4c958

        :expectedresults: Media entity is created and updated properly

        :CaseLevel: Integration
        """
        media = entities.Media(organization=[self.org]).create()
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        self.assertEqual(media.path_, new_url)
Exemple #2
0
    def test_positive_update_name(self):
        """Create media entity providing the initial name, then update
        its name to another valid name.

        @Feature: Media

        @Assert: Media entity is created and updated properly
        """
        media = entities.Media(organization=[self.org]).create()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                media = entities.Media(id=media.id,
                                       name=new_name).update(['name'])
                self.assertEqual(media.name, new_name)
Exemple #3
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)
Exemple #4
0
    def test_positive_update_name(self):
        """Create media entity providing the initial name, then update
        its name to another valid name.

        :id: a99c3c27-ad0a-474f-ad80-cb61022618a9

        :expectedresults: Media entity is created and updated properly
        """
        media = entities.Media(organization=[self.org]).create()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                media = entities.Media(id=media.id,
                                       name=new_name).update(['name'])
                self.assertEqual(media.name, new_name)
Exemple #5
0
    def test_negative_update_name(self):
        """Create media entity providing the initial name, then try to
        update its name to invalid one.

        :id: 1c7d3af1-8cef-454e-80b6-a8e95b5dfa8b

        :expectedresults: Media entity is not updated

        :CaseImportance: Critical
        """
        media = entities.Media(organization=[self.org]).create()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(HTTPError):
                    entities.Media(id=media.id, name=new_name).update(['name'])
    def test_positive_create_with_media(self):
        """Create a hostgroup with media specified

        @feature: HostGroup

        @assert: A hostgroup is created with expected media assigned
        """
        arch = entities.Architecture().create()
        ptable = entities.PartitionTable().create()
        os = entities.OperatingSystem(
            architecture=[arch],
            ptable=[ptable],
        ).create()
        media = entities.Media(
            operatingsystem=[os],
            location=[self.loc],
            organization=[self.org],
        ).create()
        hostgroup = entities.HostGroup(
            architecture=arch,
            location=[self.loc],
            medium=media,
            operatingsystem=os,
            organization=[self.org],
            ptable=ptable,
        ).create()
        self.assertEqual(hostgroup.medium.read().name, media.name)
Exemple #7
0
    def test_positive_create_with_media(self):
        """Create a hostgroup with media specified

        :id: b0b93207-a8bc-4af7-8ccd-d0bbf46dc0b0

        :expectedresults: A hostgroup is created with expected media assigned

        :CaseLevel: Integration
        """
        arch = entities.Architecture().create()
        ptable = entities.PartitionTable().create()
        os = entities.OperatingSystem(
            architecture=[arch],
            ptable=[ptable],
        ).create()
        media = entities.Media(
            operatingsystem=[os],
            location=[self.loc],
            organization=[self.org],
        ).create()
        hostgroup = entities.HostGroup(
            architecture=arch,
            location=[self.loc],
            medium=media,
            operatingsystem=os,
            organization=[self.org],
            ptable=ptable,
        ).create()
        self.assertEqual(hostgroup.medium.read().name, media.name)
Exemple #8
0
    def test_positive_update_media(self):
        """Add/Remove medium from/to organization.

        :id: bcf3aaf4-cad9-4a22-a087-60b213eb87cf

        :expectedresults: medium is added then removed.

        :CaseLevel: Integration
        """
        with Session(self.browser) as session:
            org_name = gen_string('alpha')
            make_org(session, org_name=org_name)
            for media_name in generate_strings_list():
                with self.subTest(media_name):
                    # Create media using nailgun
                    media = entities.Media(
                        name=media_name,
                        path_=INSTALL_MEDIUM_URL % gen_string('alpha', 6),
                        os_family='Redhat',
                    ).create()
                    self.assertEqual(media.name, media_name)
                    kwargs = {
                        'org_name': org_name,
                        'entity_type': 'medias',
                        'entity_name': media_name
                    }
                    self.assertIsNotNone(self.org.add_entity(**kwargs))
                    self.assertIsNotNone(self.org.remove_entity(**kwargs))
Exemple #9
0
 def setupScenario(self):
     """Create hostgroup and its dependant entities
     """
     self.org = entities.Organization().create()
     self.loc = entities.Location(organization=[self.org]).create()
     self.parent_hostgroup = entities.HostGroup(
         location=[self.loc.id],
         organization=[self.org.id],
         name=self.parent_name).create()
     self.lc_env = entities.LifecycleEnvironment(
         name=gen_string('alpha'),
         organization=self.org,
     ).create()
     self.domain = entities.Domain(name=self.domain_name).create()
     self.architecture = entities.Architecture().create()
     self.ptable = entities.PartitionTable().create()
     self.operatingsystem = entities.OperatingSystem(
         architecture=[self.architecture],
         ptable=[self.ptable],
         name=self.os_name).create()
     self.medium = entities.Media(
         operatingsystem=[self.operatingsystem]).create()
     self.subnet = entities.Subnet(location=[self.loc],
                                   organization=[self.org],
                                   name=self.subnet_name).create()
    def test_positive_add_medium(self):
        """Add medium by using the organization name and medium name.

        @feature: Organizations associate medium.

        @assert: medium is added.
        """
        strategy, value = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for medium_name in generate_strings_list():
                with self.subTest(medium_name):
                    org_name = gen_string('alpha')
                    # Create media using nailgun
                    medium = entities.Media(
                        name=medium_name,
                        path_=INSTALL_MEDIUM_URL % gen_string('alpha', 6),
                        os_family='Redhat',
                    ).create()
                    self.assertEqual(medium.name, medium_name)
                    make_org(session, org_name=org_name)
                    self.assertIsNotNone(self.org.search(org_name))
                    self.org.update(org_name, new_medias=[medium_name])
                    self.org.search(org_name).click()
                    session.nav.click(tab_locators['context.tab_media'])
                    element = session.nav.wait_until_element(
                        (strategy, value % medium_name))
                    self.assertIsNotNone(element)
Exemple #11
0
    def test_positive_sort_by_url(self):
        """Create some medium entities and sort them by url path

        :id: 6399f4ad-c081-46c4-89f6-70e552fb603a

        :customerscenario: true

        :expectedresults: Medium entities are sorted properly

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        path_list = [
            gen_url(subdomain=gen_string('alpha', 20).lower(), scheme='https')
            for _ in range(5)
        ]
        for url in path_list:
            entities.Media(path_=url, organization=[organization]).create()
        path_list.sort(key=lambda x: x.split('.', 1)[0], reverse=True)
        with Session(self) as session:
            set_context(session, org=organization.name)
            self.medium.navigate_to_entity()
            self.assertEqual(self.medium.sort_table_by_column('Path'),
                             path_list[::-1])
            self.assertEqual(self.medium.sort_table_by_column('Path'),
                             path_list)
Exemple #12
0
    def test_positive_create_update_url(self, module_org):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        :id: a183ee1f-1633-42cd-9132-cce451861b2a

        :expectedresults: Media entity is created and updated properly

        :CaseImportance: Medium
        """
        url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(organization=[module_org], path_=url).create()
        assert media.path_ == url
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        assert media.path_ == new_url
Exemple #13
0
    def test_positive_add_medium(self):
        """Add medium by using the location name and medium name

        :id: 738c5ff1-ef09-466f-aaac-64f194cac78d

        :expectedresults: medium is added

        :CaseLevel: Integration
        """
        strategy, value = common_locators['entity_deselect']
        with Session(self.browser) as session:
            for medium_name in generate_strings_list():
                with self.subTest(medium_name):
                    loc_name = gen_string('alpha')
                    medium = entities.Media(
                        name=medium_name,
                        path_=INSTALL_MEDIUM_URL % gen_string('alpha', 6),
                        os_family='Redhat',
                    ).create()
                    self.assertEqual(medium.name, medium_name)
                    make_loc(session, name=loc_name)
                    self.assertIsNotNone(self.location.search(loc_name))
                    self.location.update(loc_name, new_medias=[medium_name])
                    self.location.search_and_click(loc_name)
                    session.nav.click(tab_locators['context.tab_media'])
                    element = session.nav.wait_until_element(
                        (strategy, value % medium_name))
                    self.assertIsNotNone(element)
Exemple #14
0
    def test_negative_create_with_invalid_os_family(self):
        """Try to create media entity providing an invalid OS family

        @id: 368b7eac-8c52-4071-89c0-1946d7101291

        @Assert: Media entity is not created
        """
        with self.assertRaises(HTTPError):
            entities.Media(os_family='NON_EXISTENT_OS').create()
Exemple #15
0
    def test_negative_create_with_invalid_os_family(self):
        """Try to create media entity providing an invalid OS family

        @Feature: Media

        @Assert: Media entity is not created
        """
        with self.assertRaises(HTTPError):
            entities.Media(os_family='NON_EXISTENT_OS').create()
Exemple #16
0
    def test_negative_create_with_invalid_url(self):
        """Try to create media entity providing an invalid URL

        @id: ae00b6bb-37ed-459e-b9f7-acc92ed0b262

        @Assert: Media entity is not created
        """
        with self.assertRaises(HTTPError):
            entities.Media(path_='NON_EXISTENT_URL').create()
Exemple #17
0
    def test_positive_crud_with_name(self, module_org, name, new_name):
        """Create, update, delete media with valid name only

        :id: b07a4549-7dd5-4b36-a1b4-9f8d48ddfcb5

        :parametrized: yes

        :expectedresults: Media entity is created and has proper name

        :CaseImportance: Critical
        """
        media = entities.Media(organization=[module_org], name=name).create()
        assert media.name == name
        media = entities.Media(id=media.id, name=new_name).update(['name'])
        assert media.name == new_name
        media.delete()
        with pytest.raises(HTTPError):
            media.read()
    def test_positive_update_media(self):
        """Create an operating system that points at media entity and
        then update it to point to another media

        @Feature: Operating System

        @Assert: The operating system is updated and points at the expected
        media.
        """
        media_1 = entities.Media(organization=[self.org]).create()
        media_2 = entities.Media(organization=[self.org]).create()
        os = entities.OperatingSystem(medium=[media_1]).create()
        self.assertEqual(len(os.medium), 1)
        self.assertEqual(os.medium[0].id, media_1.id)
        os = entities.OperatingSystem(id=os.id,
                                      medium=[media_2]).update(['medium'])
        self.assertEqual(len(os.medium), 1)
        self.assertEqual(os.medium[0].id, media_2.id)
Exemple #19
0
    def test_negative_create_with_invalid_url(self):
        """Try to create media entity providing an invalid URL

        @Feature: Media

        @Assert: Media entity is not created
        """
        with self.assertRaises(HTTPError):
            entities.Media(path_='NON_EXISTENT_URL').create()
    def test_positive_update_media(self, module_org):
        """Create an operating system that points at media entity and
        then update it to point to another media

        :id: 18b5f6b5-52ab-4722-8412-f0de85ad20fe

        :expectedresults: The operating system is updated and points at the
            expected media.

        :CaseLevel: Integration
        """
        media_1 = entities.Media(organization=[module_org]).create()
        media_2 = entities.Media(organization=[module_org]).create()
        os = entities.OperatingSystem(medium=[media_1]).create()
        assert len(os.medium) == 1
        assert os.medium[0].id == media_1.id
        os = entities.OperatingSystem(id=os.id, medium=[media_2]).update(['medium'])
        assert len(os.medium) == 1
        assert os.medium[0].id == media_2.id
    def test_positive_update_media(self):
        """Create an operating system that points at media entity and
        then update it to point to another media

        @id: 18b5f6b5-52ab-4722-8412-f0de85ad20fe

        @Assert: The operating system is updated and points at the expected
        media.

        @CaseLevel: Integration
        """
        media_1 = entities.Media(organization=[self.org]).create()
        media_2 = entities.Media(organization=[self.org]).create()
        os = entities.OperatingSystem(medium=[media_1]).create()
        self.assertEqual(len(os.medium), 1)
        self.assertEqual(os.medium[0].id, media_1.id)
        os = entities.OperatingSystem(id=os.id,
                                      medium=[media_2]).update(['medium'])
        self.assertEqual(len(os.medium), 1)
        self.assertEqual(os.medium[0].id, media_2.id)
Exemple #22
0
    def test_negative_create_with_invalid_name(self):
        """Try to create media entity providing an invalid name

        @id: 0934f4dc-f674-40fe-a639-035761139c83

        @Assert: Media entity is not created
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(HTTPError):
                    entities.Media(name=name).create()
Exemple #23
0
    def test_pre_create_hostgroup(self, request):
        """Hostgroup with different data type are created

        :id: preupgrade-79958754-94b6-4bfe-af12-7d4031cd2dd2

        :steps: In Preupgrade Satellite, Create hostgroup with different entities.

        :expectedresults: Hostgroup should be create successfully.
        """

        proxy = entities.SmartProxy().search(
            query={'search': f'url = https://{settings.server.hostname}:9090'
                   })[0]
        test_name = request.node.name
        org = entities.Organization(name=f"{test_name}_org").create()
        loc = entities.Location(organization=[org],
                                name=f"{test_name}_loc").create()
        parent_hostgroup = entities.HostGroup(
            location=[loc.id],
            organization=[org.id],
            name=f'{test_name}_parent_host_grp').create()
        lc_env = entities.LifecycleEnvironment(name=f"{test_name}_lce",
                                               organization=org).create()

        domain = entities.Domain(name=f"{test_name}_domain").create()
        architecture = entities.Architecture().create()
        ptable = entities.PartitionTable().create()
        operatingsystem = entities.OperatingSystem(
            architecture=[architecture],
            ptable=[ptable],
            name=f"{test_name}_os").create()
        medium = entities.Media(operatingsystem=[operatingsystem]).create()
        subnet = entities.Subnet(location=[loc],
                                 organization=[org],
                                 name=f"{test_name}_subnet").create()

        host_group = entities.HostGroup(
            architecture=architecture,
            domain=domain,
            location=[loc.id],
            medium=medium,
            name=f"{test_name}_host_grp",
            operatingsystem=operatingsystem,
            organization=[org.id],
            ptable=ptable,
            puppet_proxy=proxy,
            puppet_ca_proxy=proxy,
            subnet=subnet,
            parent=parent_hostgroup,
            lifecycle_environment=lc_env,
            content_source=proxy,
            root_pass='******',
        ).create()
        assert host_group.name == f"{test_name}_host_grp"
Exemple #24
0
    def test_negative_create_with_invalid_os_family(self):
        """Try to create media entity providing an invalid OS family

        :id: 368b7eac-8c52-4071-89c0-1946d7101291

        :expectedresults: Media entity is not created

        :CaseImportance: Medium
        """
        with pytest.raises(HTTPError):
            entities.Media(os_family='NON_EXISTENT_OS').create()
Exemple #25
0
    def test_negative_create_with_invalid_url(self):
        """Try to create media entity providing an invalid URL

        :id: ae00b6bb-37ed-459e-b9f7-acc92ed0b262

        :expectedresults: Media entity is not created

        :CaseImportance: Medium
        """
        with pytest.raises(HTTPError):
            entities.Media(path_='NON_EXISTENT_URL').create()
Exemple #26
0
    def test_negative_create_with_invalid_name(self):
        """Try to create media entity providing an invalid name

        @Feature: Media

        @Assert: Media entity is not created
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(HTTPError):
                    entities.Media(name=name).create()
    def test_positive_update_medias(self):
        """Create an operating system that points at media entity and
        then update it to point to another multiple different medias.

        @Feature: Operating System

        @Assert: The operating system is updated and points at the expected
        medias.
        """
        initial_media = entities.Media(organization=[self.org]).create()
        os = entities.OperatingSystem(medium=[initial_media]).create()
        self.assertEqual(len(os.medium), 1)
        self.assertEqual(os.medium[0].id, initial_media.id)
        amount = range(random.randint(3, 5))
        medias = [entities.Media().create() for _ in amount]
        os = entities.OperatingSystem(id=os.id,
                                      medium=medias).update(['medium'])
        self.assertEqual(len(os.medium), len(amount))
        self.assertEqual(set([medium.id for medium in os.medium]),
                         set([medium.id for medium in medias]))
    def test_positive_create_with_media(self):
        """Create an operating system that points at a media.

        @Feature: Operating System

        @Assert: The operating system is created and points at the given media.
        """
        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)
    def test_positive_update_medias(self, module_org):
        """Create an operating system that points at media entity and
        then update it to point to another multiple different medias.

        :id: 756c4aa8-278d-488e-b48f-a8d2ace4526e

        :expectedresults: The operating system is updated and points at the
            expected medias.

        :CaseLevel: Integration
        """
        initial_media = entities.Media(organization=[module_org]).create()
        os = entities.OperatingSystem(medium=[initial_media]).create()
        assert len(os.medium) == 1
        assert os.medium[0].id == initial_media.id
        amount = range(random.randint(3, 5))
        medias = [entities.Media().create() for _ in amount]
        os = entities.OperatingSystem(id=os.id, medium=medias).update(['medium'])
        assert len(os.medium) == len(amount)
        assert {medium.id for medium in os.medium} == {medium.id for medium in medias}
Exemple #30
0
    def test_positive_create_with_location(self, module_org, module_location):
        """Create media entity assigned to non-default location

        :id: 1c4fa736-c145-46ca-9feb-c4046fc778c6

        :expectedresults: Media entity is created and has proper location

        :CaseLevel: Integration
        """
        media = entities.Media(organization=[module_org],
                               location=[module_location]).create()
        assert media.location[0].read().name == module_location.name