コード例 #1
0
    def test_negative_validate_matcher_and_default_value(self):
        """Error for invalid default and matcher value both at a time.

        @id: 07dfcdad-e619-4672-9fe8-75a8352e44a4

        @steps:

        1.  Override the parameter.
        2.  Update parameter default type with Invalid value.
        3.  Create a matcher with value that doesn't matches the default type.
        4.  Attempt to submit the change.

        @assert: Error raised for invalid default and matcher value both.
        """
        sc_param_id = self.sc_params_ids_list.pop()
        SmartClassParameter.add_override_value({
            'smart-class-parameter-id': sc_param_id,
            'match': 'domain=test.com',
            'value': gen_string('alpha'),
        })
        with self.assertRaises(CLIReturnCodeError):
            SmartClassParameter.update({
                'id': sc_param_id,
                'parameter-type': 'boolean',
                'override': 1,
                'default-value': gen_string('alpha'),
            })
コード例 #2
0
ファイル: utils.py プロジェクト: jhutar/robottelo
def create_fake_host(session, host, interface_id=gen_string('alpha'),
                     global_parameters=None, host_parameters=None, extra_values=None):
    if extra_values is None:
        extra_values = {}
    os_name = u'{0} {1}'.format(
        host.operatingsystem.name, host.operatingsystem.major)
    name = host.name if host.name is not None else gen_string('alpha').lower()
    values = {
        'host.name': name,
        'host.organization': host.organization.name,
        'host.location': host.location.name,
        'host.lce': ENVIRONMENT,
        'host.content_view': DEFAULT_CV,
        'host.puppet_environment': host.environment.name,
        'operating_system.architecture': host.architecture.name,
        'operating_system.operating_system': os_name,
        'operating_system.media_type': 'All Media',
        'operating_system.media': host.medium.name,
        'operating_system.ptable': host.ptable.name,
        'operating_system.root_password': host.root_pass,
        'interfaces.interface.interface_type': 'Interface',
        'interfaces.interface.device_identifier': interface_id,
        'interfaces.interface.mac': host.mac,
        'interfaces.interface.domain': host.domain.name,
        'interfaces.interface.primary': True,
        'interfaces.interface.interface_additional_data.virtual_nic': False,
        'parameters.global_params': global_parameters,
        'parameters.host_params': host_parameters,
    }
    values.update(extra_values)
    session.host.create(values)
    return '{0}.{1}'.format(name, host.domain.name)
コード例 #3
0
ファイル: test_user.py プロジェクト: lhellebr/robottelo
def test_positive_create_with_multiple_orgs(session):
    """Create User associated to multiple Orgs

    :id: d74c0284-3995-4a4a-8746-00858282bf5d

    :expectedresults: User is created successfully

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    org_name1 = gen_string('alpha')
    org_name2 = gen_string('alpha')
    password = gen_string('alpha')
    for org_name in [org_name1, org_name2]:
        entities.Organization(name=org_name).create()
    with session:
        session.organization.select(org_name=DEFAULT_ORG)
        session.user.create({
            'user.login': name,
            'user.auth': 'INTERNAL',
            'user.password': password,
            'user.confirm': password,
            'organizations.resources.assigned': [org_name1, org_name2],
        })
        assert session.user.search(name) == name
        user_values = session.user.read(name)
        assert (
            set(user_values['organizations']['resources']['assigned']) ==
            set([DEFAULT_ORG, org_name1, org_name2])
        )
コード例 #4
0
ファイル: test_host.py プロジェクト: jhutar/robottelo
def test_positive_search_by_parameter_with_prefix(session, module_loc):
    """Search by global parameter assigned to host using prefix 'not' and
    any random string as parameter value to make sure that all hosts will
    be present in the list

    :id: a4affb90-1222-4d9a-94be-213f9e5be573

    :expectedresults: All assigned hosts to organization are returned by
        search

    :CaseLevel: Integration
    """
    org = entities.Organization().create()
    param_name = gen_string('alpha')
    param_value = gen_string('alpha')
    search_param_value = gen_string('alphanumeric')
    parameters = [{'name': param_name, 'value': param_value}]
    param_host = entities.Host(
        organization=org,
        location=module_loc,
        host_parameters_attributes=parameters,
    ).create()
    additional_host = entities.Host(organization=org, location=module_loc).create()
    with session:
        session.organization.select(org_name=org.name)
        # Check that the hosts are present
        for host in [param_host, additional_host]:
            assert session.host.search(host.name)[0]['Name'] == host.name
        # Check that search by parameter with 'not' prefix returns both hosts
        values = session.host.search('not params.{0} = {1}'.format(param_name, search_param_value))
        assert {value['Name'] for value in values} == {param_host.name, additional_host.name}
コード例 #5
0
def test_positive_rename(session):
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    entities.ComputeProfile(name=name).create()
    with session:
        session.computeprofile.rename(name, {'name': new_name})
        assert session.computeprofile.search(new_name)[0]['Name'] == new_name
コード例 #6
0
ファイル: test_host.py プロジェクト: jhutar/robottelo
def test_positive_create_with_inherited_params(session):
    """Create a new Host in organization and location with parameters

    :BZ: 1287223

    :id: 628122f2-bda9-4aa1-8833-55debbd99072

    :expectedresults: Host has inherited parameters from organization and
        location

    :CaseImportance: High
    """
    org = entities.Organization().create()
    loc = entities.Location(organization=[org]).create()
    org_param = dict(name=gen_string('alphanumeric'), value=gen_string('alphanumeric'))
    loc_param = dict(name=gen_string('alphanumeric'), value=gen_string('alphanumeric'))
    host_template = entities.Host(organization=org, location=loc)
    host_template.create_missing()
    host_name = u'{0}.{1}'.format(host_template.name, host_template.domain.name)
    with session:
        session.organization.update(org.name, {'parameters.resources': org_param})
        session.location.update(loc.name, {'parameters.resources': loc_param})
        session.organization.select(org_name=org.name)
        session.location.select(loc_name=loc.name)
        create_fake_host(session, host_template)
        values = session.host.read(host_name, 'parameters')
        expected_params = {(org_param['name'], org_param['value']),
                           (loc_param['name'], loc_param['value'])}
        assert expected_params.issubset(
            {(param['name'], param['value']) for param in values['parameters']['global_params']}
        )
コード例 #7
0
ファイル: test_host.py プロジェクト: jhutar/robottelo
def test_positive_search_by_parameter(session, module_org, module_loc):
    """Search for the host by global parameter assigned to it

    :id: 8e61127c-d0a0-4a46-a3c6-22d3b2c5457c

    :expectedresults: Only one specific host is returned by search

    :CaseLevel: Integration
    """
    param_name = gen_string('alpha')
    param_value = gen_string('alpha')
    parameters = [{'name': param_name, 'value': param_value}]
    param_host = entities.Host(
        organization=module_org,
        location=module_loc,
        host_parameters_attributes=parameters,
    ).create()
    additional_host = entities.Host(organization=module_org, location=module_loc).create()
    with session:
        # Check that hosts present in the system
        for host in [param_host, additional_host]:
            assert session.host.search(host.name)[0]['Name'] == host.name
        # Check that search by parameter returns only one host in the list
        values = session.host.search('params.{0} = {1}'.format(param_name, param_value))
        assert len(values) == 1
        assert values[0]['Name'] == param_host.name
コード例 #8
0
    def test_positive_delete_job_template(self):
        """Delete a job template

        :id: b25e4fb9-ad75-407d-b15f-76df381c4f9c

        :Setup: Create a valid job template.

        :Steps:

            1. Click the dropdown next to the Job Template's Run button
            2. Select Delete from the list
            3. Confirm the deletion

        :expectedresults: The Job Template has been deleted

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.jobtemplate.delete(name, dropdown_present=True)
コード例 #9
0
def invalid_sc_parameters_data():
    """Returns a list of invalid smart class parameter types and values"""
    return [
        {
            u'sc_type': 'boolean',
            u'value': gen_string('alphanumeric'),
        },
        {
            u'sc_type': 'integer',
            u'value': gen_string('utf8'),
        },
        {
            u'sc_type': 'real',
            u'value': gen_string('alpha'),
        },
        {
            u'sc_type': 'array',
            u'value': '0',
        },
        {
            u'sc_type': 'hash',
            u'value': 'a:test',
        },
        {
            u'sc_type': 'yaml',
            u'value': '{a:test}',
        },
        {
            u'sc_type': 'json',
            u'value': gen_string('alpha'),
        },
    ]
コード例 #10
0
ファイル: test_user.py プロジェクト: lhellebr/robottelo
def test_positive_create_with_multiple_roles(session):
    """Create User with multiple roles

    :id: d3cc4434-25ca-4465-8878-42495390c17b

    :expectedresults: User is created successfully and has proper roles
        assigned

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    role1 = gen_string('alpha')
    role2 = gen_string('alpha')
    password = gen_string('alpha')
    for role in [role1, role2]:
        entities.Role(name=role).create()
    with session:
        session.user.create({
            'user.login': name,
            'user.auth': 'INTERNAL',
            'user.password': password,
            'user.confirm': password,
            'roles.resources.assigned': [role1, role2],
        })
        assert session.user.search(name) == name
        user_values = session.user.read(name)
        assert (
            set(user_values['roles']['resources']['assigned']) ==
            set([role1, role2])
        )
コード例 #11
0
    def test_positive_view_diff(self):
        """View diff within template editor

        @id: 4b8fff93-4862-4119-bb97-aadc50fc817d

        @Setup: Create a valid job template.

        @Steps:

        1. Open the job template created during setup
        2. Modify the template's code
        3. Click the Diff button

        @Assert: Verify that the new changes are displayed in the window
        """
        name = gen_string('alpha')
        old_template = gen_string('alpha')
        new_template = gen_string('alphanumeric')
        with Session(self.browser) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=old_template,
            )
            self.jobtemplate.click(self.jobtemplate.search(name))
            self.jobtemplate.assign_value(
                locators['job.template_input'], new_template)
            self.jobtemplate.click(common_locators['ace.diff'])
            template_text = self.jobtemplate.wait_until_element(
                locators['job.template_input']).text
            self.assertIn('-' + old_template, template_text)
            self.assertIn('+' + new_template, template_text)
コード例 #12
0
    def test_negative_validate_matcher_value_with_regex(self):
        """Error raised for matcher value not matching with regex.

        @id: b8b2f1c2-a20c-42d6-a687-79e6eee0268e

        @steps:

        1.  Override the parameter.
        2.  Create a matcher with value that doesn't match
        the regex of step 3.
        3.  Validate this value with regex validator type and rule.
        4.  Submit the change.

        @assert: Error raised for matcher value not matching with regex.
        """
        value = gen_string('numeric')
        sc_param_id = self.sc_params_ids_list.pop()
        SmartClassParameter.add_override_value({
            'smart-class-parameter-id': sc_param_id,
            'match': 'domain=test.com',
            'value': gen_string('alpha')
        })
        with self.assertRaises(CLIReturnCodeError):
            SmartClassParameter.update({
                'id': sc_param_id,
                'default-value': value,
                'override': 1,
                'validator-type': 'regexp',
                'validator-rule': '[0-9]',
            })
        sc_param = SmartClassParameter.info({
            'puppet-class': self.puppet_class['name'],
            'id': sc_param_id,
        })
        self.assertNotEqual(sc_param['default-value'], value)
コード例 #13
0
ファイル: test_repository.py プロジェクト: pondrejk/robottelo
def test_positive_upstream_with_credentials(session, module_prod):
    """Create repository with upstream username and password update them and then clear them.

    :id: 141a95f3-79c4-48f8-9c95-e4b128045cb3

    :expectedresults:

        1. The custom repository is created with upstream credentials.
        2. The custom repository upstream credentials are updated.
        3. The credentials are cleared.

    :CaseLevel: Integration

    :CaseImportance: High

    :BZ: 1433481
    """
    repo_name = gen_string('alpha')
    upstream_username = gen_string('alpha')
    upstream_password = gen_string('alphanumeric')
    new_upstream_username = gen_string('alpha')
    new_upstream_password = gen_string('alphanumeric')
    hidden_password = '******' * 8
    with session:
        session.repository.create(
            module_prod.name,
            {
                'name': repo_name,
                'repo_type': REPO_TYPE['yum'],
                'repo_content.upstream_url': FAKE_1_YUM_REPO,
                'repo_content.upstream_username': upstream_username,
                'repo_content.upstream_password': upstream_password,
            }
        )
        assert session.repository.search(module_prod.name, repo_name)[0]['Name'] == repo_name
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert repo_values['repo_content']['upstream_authorization'] == '{0} / {1}'.format(
            upstream_username, hidden_password)
        session.repository.update(
            module_prod.name,
            repo_name,
            {
                'repo_content.upstream_authorization': dict(
                    username=new_upstream_username,
                    password=new_upstream_password
                ),
            }
        )
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert repo_values['repo_content']['upstream_authorization'] == '{0} / {1}'.format(
            new_upstream_username, hidden_password)
        session.repository.update(
            module_prod.name,
            repo_name,
            {
                'repo_content.upstream_authorization': {},
            }
        )
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert not repo_values['repo_content']['upstream_authorization']
コード例 #14
0
ファイル: test_role.py プロジェクト: jhutar/robottelo
def test_positive_assign_cloned_role(session):
    """Clone role and assign it to user

    :id: cbb17f37-9039-4875-981b-1f427b095ed1

    :customerscenario: true

    :expectedresults: User is created successfully

    :BZ: 1353788

    :CaseImportance: Critical
    """
    role_name = random.choice(ROLES)
    cloned_role_name = gen_string('alpha')
    user_name = gen_string('alpha')
    user_password = gen_string('alpha')
    with session:
        session.role.clone(role_name, {'name': cloned_role_name})
        assert session.role.search(cloned_role_name)[0]['Name'] == cloned_role_name
        session.user.create({
            'user.login': user_name,
            'user.auth': 'INTERNAL',
            'user.password': user_password,
            'user.confirm': user_password,
            'roles.resources.assigned': [cloned_role_name],
        })
        assert session.user.search(user_name)[0]['Username'] == user_name
        user = session.user.read(user_name)
        assert user['roles']['resources']['assigned'] == [cloned_role_name]
コード例 #15
0
    def test_positive_update_parameter(self):
        """Subnet parameter can be updated

        :id: 8c389c3f-60ef-4856-b8fc-c5b066c67a2f

        :steps:

            1. Create valid subnet with valid parameter
            2. Update above subnet parameter with new name and
                value

        :expectedresults: The parameter name and value should be updated
        """
        parameter = [{
            'name': gen_string('alpha'), 'value': gen_string('alpha')
        }]
        subnet = entities.Subnet(
            subnet_parameters_attributes=parameter).create()
        update_parameter = [{
            'name': gen_string('utf8'), 'value': gen_string('utf8')
        }]
        subnet.subnet_parameters_attributes = update_parameter
        up_subnet = subnet.update(['subnet_parameters_attributes'])
        self.assertEqual(
            up_subnet.subnet_parameters_attributes[0]['name'],
            update_parameter[0]['name']
        )
        self.assertEqual(
            up_subnet.subnet_parameters_attributes[0]['value'],
            update_parameter[0]['value']
        )
コード例 #16
0
def test_positive_edit_resource_description(
        session, module_ca_cert, rhev_data, version):
    """Edit RHEV Compute Resource with another description

    :id: f75544b1-3943-4cc6-98d1-f2d0fbe7244c

    :expectedresults: resource updated successfully and has new description

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    description = gen_string('alpha')
    new_description = gen_string('alpha')
    with session:
        session.computeresource.create({
            'name': name,
            'description': description,
            'provider': FOREMAN_PROVIDERS['rhev'],
            'provider_content.url': rhev_data['rhev_url'],
            'provider_content.user': rhev_data['username'],
            'provider_content.password': rhev_data['password'],
            'provider_content.api4': version,
            'provider_content.datacenter.value': rhev_data['datacenter'],
            'provider_content.certification_authorities': module_ca_cert
        })
        resource_values = session.computeresource.read(name)
        assert resource_values['description'] == description
        session.computeresource.edit(name, {'description': new_description})
        resource_values = session.computeresource.read(name)
        assert resource_values['description'] == new_description
コード例 #17
0
    def test_negative_update_parameter(self):
        """Subnet parameter can not be updated with invalid names

        :id: fcdbad13-ad96-4152-8e20-e023d61a2853

        :steps:

            1. Create valid subnet with valid parameter
            2. Update above subnet parameter with some invalid
                name. e.g name with spaces

        :expectedresults:

            1. The parameter should not be updated with invalid name
            2. An error for invalid name should be thrown
        """
        subnet = entities.Subnet().create()
        sub_param = entities.Parameter(
            name=gen_string('utf8'),
            subnet=subnet.id,
            value=gen_string('utf8')
        ).create()
        invalid_values = invalid_values_list() + ['name with space']
        for new_name in invalid_values:
            with self.subTest(new_name):
                with self.assertRaises(HTTPError):
                    sub_param.name = new_name
                    sub_param.update(['name'])
コード例 #18
0
    def test_negative_create_job_template_with_same_name(self):
        """Create Job Template with duplicate name

        :id: 2c193758-dc34-4701-863c-f2823851223a

        :Steps:

            1. Create a new job template.
            2. Enter a name that has already been used
            3. Click submit

        :expectedresults: The name duplication is caught and error is raised

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.assertIsNotNone(self.jobtemplate.search(name))
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.assertIsNotNone(self.jobtemplate.wait_until_element(
                common_locators['name_haserror']))
コード例 #19
0
ファイル: test_host.py プロジェクト: jhutar/robottelo
def test_positive_search_by_parameter_with_different_values(session, module_org, module_loc):
    """Search for the host by global parameter assigned to it by its value

    :id: c3a4551e-d759-4a9d-ba90-8db4cab3db2c

    :expectedresults: Only one specific host is returned by search

    :CaseLevel: Integration
    """
    param_name = gen_string('alpha')
    param_values = [gen_string('alpha'), gen_string('alphanumeric')]
    hosts = [
        entities.Host(
            organization=module_org,
            location=module_loc,
            host_parameters_attributes=[{'name': param_name, 'value': param_value}]
        ).create()
        for param_value in param_values
    ]
    with session:
        # Check that hosts present in the system
        for host in hosts:
            assert session.host.search(host.name)[0]['Name'] == host.name
        # Check that search by parameter returns only one host in the list
        for param_value, host in zip(param_values, hosts):
            values = session.host.search('params.{0} = {1}'.format(param_name, param_value))
            assert len(values) == 1
            assert values[0]['Name'] == host.name
コード例 #20
0
def test_positive_create_with_long_priority_list(session, puppet_class):
    """Smart variable priority order list can contain more than 255 character inside of it.

    :id: 440923cb-9d81-40c8-9d81-7bf22f503cf5

    :customerscenario: true

    :steps:
        1.  Create variable with some default value.
        2.  Set long priority order list

    :expectedresults: Smart variable is created successfully and has proper priority list.

    :BZ: 1458817

    :CaseImportance: Medium
    """
    name = gen_string('alpha')
    order_value = '\n'.join([gen_string('alpha').lower() for _ in range(60)])
    assert len(order_value) > 255
    with session:
        session.smartvariable.create({
            'variable.key': name,
            'variable.puppet_class': puppet_class.name,
            'variable.default_value': gen_string('alpha'),
            'variable.prioritize_attribute_order.order': order_value,
        })
        values = session.smartvariable.read(name)
        assert values['variable']['prioritize_attribute_order']['order'] == order_value
コード例 #21
0
def test_positive_end_to_end(session, oscap_tailoring_path):
    """Perform end to end testing for tailoring file component

    :id: 9aebccb8-6837-4583-8a8a-8883480ab688

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    name = gen_string('alpha')
    new_name = gen_string('alpha')
    org = entities.Organization().create()
    loc = entities.Location().create()
    with session:
        session.oscaptailoringfile.create({
            'file_upload.name': name,
            'file_upload.scap_file': oscap_tailoring_path,
            'organizations.resources.assigned': [org.name],
            'locations.resources.assigned': [loc.name],
        })
        assert session.oscaptailoringfile.search(name)[0]['Name'] == name
        tailroingfile_values = session.oscaptailoringfile.read(name)
        assert tailroingfile_values['file_upload']['name'] == name
        assert tailroingfile_values['file_upload'][
            'uploaded_scap_file'] == oscap_tailoring_path.rsplit('/', 1)[-1]
        assert org.name in tailroingfile_values['organizations']['resources']['assigned']
        assert loc.name in tailroingfile_values['locations']['resources']['assigned']
        session.oscaptailoringfile.update(name, {'file_upload.name': new_name})
        assert session.oscaptailoringfile.search(new_name)[0]['Name'] == new_name
        assert not session.oscaptailoringfile.search(name)
        session.oscaptailoringfile.delete(new_name)
        assert not session.oscaptailoringfile.search(new_name)
コード例 #22
0
def test_positive_clone(session):
    """Assure ability to clone a report template

    :id: 912f1619-abb0-4e0f-88ce-88b5726fdbe0

    :Steps:
        1.  Go to Report template UI
        2.  Choose a template and attempt to clone it

    :expectedresults: The template is cloned

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    clone_name = gen_string('alpha')
    content = gen_string('alpha')
    with session:
        session.reporttemplate.create({
            'template.name': name,
            'template.template_editor.editor': content,
        })
        session.reporttemplate.clone(
            name,
            {
                'template.name': clone_name,
            }
        )
        assert session.reporttemplate.search(
            clone_name)[0]['Name'] == clone_name
        assert session.reporttemplate.read(
               clone_name)['template']['template_editor']['editor'] == content
コード例 #23
0
ファイル: test_user.py プロジェクト: lhellebr/robottelo
def test_positive_update_with_multiple_roles(session):
    """Update User with multiple roles

    :id: 127fb368-09fd-4f10-8319-566a1bcb5cd2

    :expectedresults: User is updated successfully

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    role_names = [
        entities.Role().create().name
        for _ in range(3)
    ]
    password = gen_string('alpha')
    with session:
        session.user.create({
            'user.login': name,
            'user.auth': 'INTERNAL',
            'user.password': password,
            'user.confirm': password,
        })
        session.user.update(
            name,
            {'roles.resources.assigned': role_names},
        )
        assert session.user.search(name) == name
        user_values = session.user.read(name)
        assert (
            set(user_values['roles']['resources']['assigned']) ==
            set(role_names)
        )
コード例 #24
0
    def test_positive_create_job_template_input(self):
        """Create a Job Template using input

        @id: dbaf5aa9-101d-47dc-bdf8-d5b4d1a52396

        @Steps:

        1. Navigate to Hosts -> Job Templates
        2. Enter a name
        3. Navigate to the job tab
        4. Enter a job name
        5. Click the +Add Input button
        6. Add an appropriate name
        7. Choose an input type
        8. Populate the template code and reference the newly created input
        9. Click submit

        @Assert: The job template was successfully saved with new input added
        """
        name = gen_string('alpha')
        var_name = gen_string('alpha')
        with Session(self.browser) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.assertIsNotNone(self.jobtemplate.search(name))
            self.jobtemplate.add_input(name, var_name)
            self.jobtemplate.update(
                name,
                template_type='input',
                template_content='<%= input("{0}") %>'.format(var_name)
            )
コード例 #25
0
ファイル: test_user.py プロジェクト: lhellebr/robottelo
def test_positive_update_with_all_roles(session):
    """Update User with all roles

    :id: cd7a9cfb-a700-45f2-a11d-bba6be3c810d

    :expectedresults: User is updated successfully

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    password = gen_string('alpha')
    with session:
        session.user.create({
            'user.login': name,
            'user.auth': 'INTERNAL',
            'user.password': password,
            'user.confirm': password,
        })
        session.user.update(
            name,
            {'roles.resources.assigned': ROLES},
        )
        assert session.user.search(name) == name
        user_values = session.user.read(name)
        assert (
            set(user_values['roles']['resources']['assigned']) == set(ROLES))
コード例 #26
0
    def test_negative_preview_verify(self):
        """Use a template file to populate the job template

        @id: 8c0d132c-b500-44b5-a549-d32c7636a712

        @Steps:

        1. Create a new job template
        2. Add input controls under jobs
        3. Incorrectly reference those input controls in the template text
        4. And/or reference non-existent input controls in the template text
        5. Select "preview" within the template viewer

        @Assert: Verify appropriate errors are thrown
        """
        name = gen_string('alpha')
        with Session(self.browser) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alpha'),
                org=self.organization.name,
            )
            self.jobtemplate.add_input(name, gen_string('alpha'))
            self.jobtemplate.update(
                name,
                template_type='input',
                template_content='<%= input("{0}") %>'.format(
                    gen_string('alphanumeric'))
            )
            self.jobtemplate.click(self.jobtemplate.search(name))
            self.jobtemplate.click(common_locators['ace.preview'])
            self.assertIsNotNone(self.jobtemplate.wait_until_element(
                common_locators['alert.error']))
コード例 #27
0
ファイル: test_user.py プロジェクト: lhellebr/robottelo
def test_positive_update_orgs(session):
    """Assign a User to multiple Orgs

    :id: a207188d-1ad1-4ff1-9906-bae1d91104fd

    :expectedresults: User is updated

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    password = gen_string('alpha')
    org_names = [
        entities.Organization().create().name
        for _ in range(3)
    ]
    with session:
        session.organization.select(org_name=random.choice(org_names))
        session.user.create({
            'user.login': name,
            'user.auth': 'INTERNAL',
            'user.password': password,
            'user.confirm': password,
        })
        session.user.update(
            name,
            {'organizations.resources.assigned': org_names},
        )
        assert session.user.search(name) == name
        user_values = session.user.read(name)
        assert (
            set(user_values['organizations']['resources']['assigned']) ==
            set(org_names)
        )
コード例 #28
0
    def test_positive_validate_matcher_value_with_regex(self):
        """Error not raised for matcher value matching with regex.

        @id: 2c8273aa-e621-4d4e-b03e-f8d50a596bc2

        @steps:

        1.  Override the parameter.
        2.  Create a matcher with value that matches the regex of step 3.
        3.  Validate this value with regex validator type and rule.
        4.  Submit the change.

        @assert: Error not raised for matcher value matching with regex.
        """
        value = gen_string('numeric')
        sc_param_id = self.sc_params_ids_list.pop()
        SmartClassParameter.add_override_value({
            'smart-class-parameter-id': sc_param_id,
            'match': 'domain=test.com',
            'value': gen_string('numeric')
        })
        SmartClassParameter.update({
            'id': sc_param_id,
            'default-value': value,
            'override': 1,
            'validator-type': 'regexp',
            'validator-rule': '[0-9]',
        })
        sc_param = SmartClassParameter.info({
            'puppet-class': self.puppet_class['name'],
            'id': sc_param_id,
        })
        self.assertEqual(sc_param['default-value'], value)
コード例 #29
0
    def test_positive_clone_job_template(self):
        """Clone a Job Template

        :id: a1ec5d1d-907f-4d18-93d3-adb1134d9cca

        :Setup: Create a valid job template.

        :Steps:

            1. Navigate to Hosts -> Job Templates
            2. Click the clone button next to a job template
            3. Change the name
            4. Click submit

        :expectedresults: Verify all job template contents were successfully
            copied

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        clone_name = gen_string('alpha')
        with Session(self) as session:
            make_job_template(
                session,
                name=name,
                template_type='input',
                template_content=gen_string('alphanumeric', 20),
            )
            self.assertIsNotNone(self.jobtemplate.search(name))
            self.jobtemplate.clone(name, clone_name)
            self.assertIsNotNone(self.jobtemplate.search(clone_name))
コード例 #30
0
def test_positive_create_with_compresource(session,
                                           module_docker_cr, module_prod):
    """Create containers for a compute resource

    :id: 299fc13d-5c2f-4642-a6de-735c89fdd096

    :expectedresults: The docker container is created for the compute
        resource

    :CaseLevel: Integration
    """
    deploy_on = module_docker_cr.name + ' (Docker)'
    repo_name = gen_string('alpha')
    name = gen_string('alpha', 4).lower()
    repo = entities.Repository(
        name=repo_name,
        url=DOCKER_REGISTRY_HUB,
        product=module_prod,
        content_type=REPO_TYPE['docker'],
        docker_upstream_name="centos"
    ).create()
    repo.sync()
    with session:
        session.container.create({
            'preliminary.compute_resource.deploy_on': deploy_on,
            'image.content_view.lifecycle_environment': ENVIRONMENT,
            'image.content_view.content_view': DEFAULT_CV,
            'image.content_view.repository': repo.name,
            'image.content_view.tag': 'centos7.2.1511',
            'image.content_view.capsule': settings.server.hostname,
            'configuration.name': name,
            'configuration.command': 'top',
            'environment.tty': True,
        })
        assert session.container.search(name)[0]['Name'].lower() == name
コード例 #31
0
def test_positive_update_restrict_composite_view(session,
                                                 set_original_property_value):
    """Update settings parameter restrict_composite_view to Yes/True and ensure
    a composite content view may not be published or promoted, unless the component
    content view versions that it includes exist in the target environment.

    :id: a5d2d73d-064e-48af-ad62-da68e963e3ee

    :expectedresults: Parameter is updated successfully

    :CaseImportance: Critical

    :CaseLevel: Acceptance
    """
    repo_name = gen_string('alpha')
    property_name = 'restrict_composite_view'
    set_original_property_value(property_name)
    org = entities.Organization().create()
    product = entities.Product(organization=org).create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repo = entities.Repository(name=repo_name, product=product).create()
    composite_cv = entities.ContentView(
        composite=True,
        organization=org,
    ).create()
    add_content_views_to_composite(composite_cv, org, repo)
    composite_cv.publish()
    with session:
        session.organization.select(org_name=org.name)
        for param_value in ('Yes', 'No'):
            session.settings.update('name = {}'.format(property_name),
                                    param_value)
            if param_value == 'Yes':
                with raises(AssertionError) as context:
                    session.contentview.promote(composite_cv.name,
                                                'Version 1.0', lce.name)
                assert 'Administrator -> Settings -> Content page using the ' \
                       'restrict_composite_view flag.' in str(context.value)
            else:
                result = session.contentview.promote(composite_cv.name,
                                                     'Version 1.0', lce.name)
                assert lce.name in result['Environments']
コード例 #32
0
def test_positive_resource_vm_power_management(session, rhev_data):
    """Read current RHEV Compute Resource virtual machine power status and
    change it to opposite one

    :id: 47aea4b7-9258-4863-8966-900bc9e94116

    :parametrized: yes

    :expectedresults: virtual machine is powered on or powered off depending on
        its initial state

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    with session:
        session.computeresource.create(
            {
                'name': name,
                'provider': FOREMAN_PROVIDERS['rhev'],
                'provider_content.url': rhev_data['rhev_url'],
                'provider_content.user': rhev_data['username'],
                'provider_content.password': rhev_data['password'],
                'provider_content.datacenter.value': rhev_data['datacenter'],
                'provider_content.certification_authorities': rhev_data['cert'],
            }
        )
        status = session.computeresource.vm_status(name, rhev_data['vm_name'])
        if status:
            session.computeresource.vm_poweroff(name, rhev_data['vm_name'])
        else:
            session.computeresource.vm_poweron(name, rhev_data['vm_name'])

        wait_for(
            lambda: (
                session.browser.refresh(),
                session.computeresource.vm_status(name, rhev_data['vm_name']),
            )[1]
            is not status,
            timeout=180,
            delay=1,
        )
        assert session.computeresource.vm_status(name, rhev_data['vm_name']) is not status
コード例 #33
0
def test_positive_add_product_with_repos(session, module_org, gpg_content):
    """Create gpg key with valid name and valid gpg key then associate it
    with custom product that has more than one repository

    :id: 0edffad7-0ab4-4bef-b16b-f6c8de55b0dc

    :expectedresults: gpg key is properly associated with repositories

    :CaseLevel: Integration
    """
    name = gen_string('alpha')
    gpg_key = entities.GPGKey(
        content=gpg_content,
        name=name,
        organization=module_org,
    ).create()
    # Creates new product and associate GPGKey with it
    product = entities.Product(
        gpg_key=gpg_key,
        organization=module_org,
    ).create()
    # Creates new repository_1 without GPGKey
    repo1 = entities.Repository(
        product=product,
        url=FAKE_1_YUM_REPO,
    ).create()
    # Creates new repository_2 without GPGKey
    repo2 = entities.Repository(
        product=product,
        url=FAKE_2_YUM_REPO,
    ).create()
    with session:
        values = session.contentcredential.read(name)
        assert len(values['repositories']['table']) == 2
        assert (
            {repo1.name, repo2.name} ==
            set([
                repo['Name']
                for repo
                in values['repositories']['table']
            ])
        )
コード例 #34
0
ファイル: test_repository.py プロジェクト: ldjebran/robottelo
def test_positive_end_to_end_custom_module_streams_crud(
        session, module_org, module_prod):
    """Perform end to end testing for custom module streams yum repository

    :id: ea0a58ae-b280-4bca-8f22-cbed73453604

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    repo_name = gen_string('alpha')
    with session:
        session.repository.create(
            module_prod.name,
            {
                'name': repo_name,
                'repo_type': REPO_TYPE['yum'],
                'repo_content.upstream_url':
                settings.repos.module_stream_1.url,
            },
        )
        assert session.repository.search(module_prod.name,
                                         repo_name)[0]['Name'] == repo_name
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert repo_values['repo_content'][
            'upstream_url'] == settings.repos.module_stream_1.url
        result = session.repository.synchronize(module_prod.name, repo_name)
        assert result['result'] == 'success'
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert int(repo_values['content_counts']['Module Streams']) >= 5
        session.repository.update(
            module_prod.name,
            repo_name,
            {'repo_content.upstream_url': settings.repos.module_stream_0.url},
        )
        repo_values = session.repository.read(module_prod.name, repo_name)
        assert repo_values['repo_content'][
            'upstream_url'] == settings.repos.module_stream_0.url
        session.repository.delete(module_prod.name, repo_name)
        assert not session.repository.search(module_prod.name, repo_name)
コード例 #35
0
ファイル: test_audit.py プロジェクト: synkd/robottelo
def test_positive_update_by_type():
    """Update some entities of different types and check audit logs for
    these events using entity type as search criteria

    :id: 43e73a11-b241-4b91-bdf6-e966366014e8

    :expectedresults: Audit logs contain corresponding entries per each
        update event

    :CaseImportance: Medium

    :CaseComponent: AuditLog

    :Assignee: rplevka
    """
    for entity in [
            entities.Architecture(),
            entities.Domain(),
            entities.HostGroup(),
            entities.Location(),
            entities.Organization(),
            entities.Role(),
            entities.UserGroup(),
    ]:
        created_entity = entity.create()
        name = created_entity.name
        new_name = gen_string('alpha')
        created_entity.name = new_name
        created_entity = created_entity.update(['name'])
        audits = entities.Audit().search(
            query={
                'search': f'type={created_entity.__class__.__name__.lower()}'
            })
        entity_audits = [
            entry for entry in audits if entry.auditable_name == name
        ]
        assert entity_audits, f'audit not found by name "{name}"'
        audit = entity_audits[0]
        assert audit.auditable_id == created_entity.id
        assert audit.audited_changes['name'] == [name, new_name]
        assert audit.action == 'update'
        assert audit.version == 2
コード例 #36
0
ファイル: test_setting.py プロジェクト: jhutar/robottelo
    def test_positive_update_email_subject_prefix(self):
        """Check email subject prefix is updated

        :id: c8e6b323-7b39-43d6-a9f1-5474f920bba2

        :expectedresults: email_subject_prefix is updated

        :caseautomation: automated

        :caseimportance: low
        """
        email_subject_prefix_value = gen_string('alpha')
        Settings.set({
            'name': "email_subject_prefix",
            'value': email_subject_prefix_value
        })
        email_subject_prefix = Settings.list(
            {'search': 'name=email_subject_prefix'})[0]
        self.assertEqual(email_subject_prefix_value,
                         email_subject_prefix['value'])
コード例 #37
0
def test_positive_create_vmware(session, name):
    vmware_vcenter = settings.vmware.vcenter
    vmware_user = settings.vmware.username
    vmware_password = settings.vmware.password
    with session:
        session.computeresource.create({
            'name':
            name,
            'description':
            gen_string('alpha'),
            'provider':
            FOREMAN_PROVIDERS['vmware'],
            'provider_content.vcenter':
            vmware_vcenter,
            'provider_content.user':
            vmware_user,
            'provider_content.password':
            vmware_password,
        })
        assert session.computeresource.search(name)[0]['Name'] == name
コード例 #38
0
ファイル: test_container.py プロジェクト: vikask18/robottelo
def test_positive_delete(session, module_container_host):
    """Delete containers in an external compute resource

    :id: e69808e7-6a0c-4310-b57a-2271ac61d11a

    :expectedresults: The docker containers are deleted

    :CaseLevel: Integration
    """
    container = entities.DockerHubContainer(
        compute_resource=module_container_host.compute_resource,
        location=[module_container_host.location],
        name=gen_string('alpha', 4).lower(),
        organization=[module_container_host.organization],
    ).create()
    with session:
        assert session.container.search(container.name)[0]['Name'].lower() == container.name
        session.container.delete(container.name)
        assert container.name not in [
            el['Name'] for el in session.container.search(container.name)]
コード例 #39
0
    def test_negative_override(self, module_sc_params):
        """Override the Default Parameter value - override Unchecked.

        :id: eb24c44d-0e34-40a3-aa3e-05a3cd4ed1ea

        :steps:

            1.  Don't override the parameter.
            2.  Set the new valid Default Value.
            3.  Attempt to submit the changes.

        :expectedresults: Not overridden parameter value cannot be updated.

        :BZ: 1830834

        :CaseImportance: Medium
        """
        sc_param_id = module_sc_params['ids'].pop()
        with pytest.raises(CLIReturnCodeError):
            SmartClassParameter.update({'default-value': gen_string('alpha'), 'id': sc_param_id})
コード例 #40
0
def test_positive_add_empty_product(session, module_org, gpg_content):
    """Create gpg key with valid name and valid gpg key then associate
    it with empty (no repos) custom product

    :id: e18ae9f5-43d9-4049-92ca-1eafaca05096

    :expectedresults: gpg key is associated with product

    :CaseLevel: Integration
    """
    prod_name = gen_string('alpha')
    gpg_key = entities.GPGKey(content=gpg_content,
                              organization=module_org).create()
    with session:
        session.product.create({'name': prod_name, 'gpg_key': gpg_key.name})
        values = session.contentcredential.read(gpg_key.name)
        assert len(values['products']['table']) == 1
        assert values['products']['table'][0]['Name'] == prod_name
        assert values['products']['table'][0][
            'Used as'] == CONTENT_CREDENTIALS_TYPES['gpg']
コード例 #41
0
    def test_negative_create_ssh_key_with_invalid_name(self, create_user):
        """Attempt to add SSH key that has invalid name length

        :id: e1e17839-a392-45bb-bb1e-28d3cd9dba1c

        :steps:

            1. Create new user with all the details
            2. Attempt to add invalid ssh Key name to above user

        :expectedresults: Satellite should raise Name is too long assertion

        :CaseImportance: Critical
        """
        invalid_ssh_key_name = gen_string('alpha', length=300)
        with pytest.raises(HTTPError) as context:
            entities.SSHKey(user=create_user['user'],
                            name=invalid_ssh_key_name,
                            key=self.gen_ssh_rsakey()).create()
        assert re.search("Name is too long", context.value.response.text)
コード例 #42
0
    def test_negative_validate_matcher_non_existing_attribute(self):
        """Error while creating matcher for Non Existing Attribute.

        @id: 5223e582-81b4-442d-b4ba-b16ede460ef6

        @steps:

        1.  Override the parameter.
        2.  Create a matcher with non existing attribute in org.
        4.  Attempt to submit the change.

        @assert: Error raised for non existing attribute.
        """
        sc_param_id = self.sc_params_ids_list.pop()
        with self.assertRaises(CLIReturnCodeError):
            SmartClassParameter.add_override_value({
                'smart-class-parameter-id': sc_param_id,
                'match': 'non_existing_attribute',
                'value': gen_string('alpha')
            })
コード例 #43
0
    def test_negative_duplicate_name_variable(self):
        """Create Smart Variable with an existing name.

        :id: cc219111-1d2a-47ae-9b22-0b399f2d586d

        :steps:

            1. Create a smart Variable with Valid name and default value.
            2. Attempt to create a variable with same name from same/other
               class.

        :expectedresults: The variable with same name are not allowed to create
            from any class.

        :CaseImportance: Critical
        """
        name = gen_string('alpha')
        make_smart_variable({'variable': name, 'puppet-class': self.puppet_class['name']})
        with self.assertRaises(CLIReturnCodeError):
            SmartVariable.create({'variable': name, 'puppet-class': self.puppet_class['name']})
コード例 #44
0
ファイル: test_role.py プロジェクト: shweta83/robottelo
def test_positive_delete_cloned_builtin(session):
    """Delete cloned builtin role

    :id: 7f0a595b-2b27-4dca-b15a-02cd2519b2f7

    :customerscenario: true

    :expectedresults: Role is deleted

    :BZ: 1353788, 1426672

    :CaseImportance: Critical
    """
    role_name = random.choice(ROLES)
    cloned_role_name = gen_string('alpha')
    with session:
        session.role.clone(role_name, {'name': cloned_role_name})
        assert session.role.search(cloned_role_name)[0]['Name'] == cloned_role_name
        session.role.delete(cloned_role_name)
        assert not session.role.search(cloned_role_name)
コード例 #45
0
ファイル: satellite_auth.py プロジェクト: latran/robottelo
def auth_source(module_org, module_location, ad_data):
    ad_data = ad_data()
    return entities.AuthSourceLDAP(
        onthefly_register=True,
        account=ad_data['ldap_user_name'],
        account_password=ad_data['ldap_user_passwd'],
        base_dn=ad_data['base_dn'],
        groups_base=ad_data['group_base_dn'],
        attr_firstname=LDAP_ATTR['firstname'],
        attr_lastname=LDAP_ATTR['surname'],
        attr_login=LDAP_ATTR['login_ad'],
        server_type=LDAP_SERVER_TYPE['API']['ad'],
        attr_mail=LDAP_ATTR['mail'],
        name=gen_string('alpha'),
        host=ad_data['ldap_hostname'],
        tls=False,
        port='389',
        organization=[module_org],
        location=[module_location],
    ).create()
コード例 #46
0
ファイル: test_user.py プロジェクト: vikask18/robottelo
    def test_positive_create_ssh_key(self):
        """SSH Key can be added to User

        :id: d00905f6-3a70-4e2f-a5ae-fcac18274bb7

        :steps:

            1. Create new user with all the details
            2. Add SSH key to the above user

        :expectedresults: SSH key should be added to user

        :CaseImportance: Critical
        """
        ssh_name = gen_string('alpha')
        ssh_key = self.gen_ssh_rsakey()
        user_sshkey = entities.SSHKey(
            user=self.user, name=ssh_name, key=ssh_key).create()
        self.assertEqual(ssh_name, user_sshkey.name)
        self.assertEqual(ssh_key, user_sshkey.key)
コード例 #47
0
def test_positive_host_dmi_uuid_duplicates(session, setting_update):
    """Check the setting host_dmi_uuid_duplicates value update.

    :id: 529ddd3a-1271-4043-9006-eac436b08b11

    :parametrized: yes

    :BZ: 1975713

    :expectedresults: Value of host_dmi_uuid_duplicates should be updated successfully

    :CaseImportance: High
    """
    property_value = gen_string("alpha")
    property_name = setting_update.name
    with session:
        session.settings.update(f'name = {setting_update.name}',
                                property_value)
        result = session.settings.read(f'name = {property_name}')
        assert result['table'][0]['Value'].strip('[]') == property_value
コード例 #48
0
def test_positive_read_from_details_page(session):
    """Create new Host and read all its content through details page

    :id: ffba5d40-918c-440e-afbb-6b910db3a8fb

    :expectedresults: Host is created and has expected content

    :CaseLevel: System
    """
    host = entities.Host()
    host.create_missing()
    os_name = u'{0} {1}'.format(
        host.operatingsystem.name, host.operatingsystem.major)
    interface_id = gen_string('alpha')
    host_name = u'{0}.{1}'.format(host.name, host.domain.name)
    with session:
        session.organization.select(org_name=host.organization.name)
        session.location.select(loc_name=host.location.name)
        create_fake_host(session, host, interface_id)
        assert session.host.search(host_name)[0]['Name'] == host_name
        values = session.host.get_details(host_name)
        assert values['properties']['properties_table'][
            'Status'] == 'OK'
        assert values['properties']['properties_table'][
            'Build'] == 'Pending installation'
        assert values['properties']['properties_table'][
            'Domain'] == host.domain.name
        assert values['properties']['properties_table'][
            'MAC Address'] == host.mac
        assert values['properties']['properties_table'][
            'Puppet Environment'] == host.environment.name
        assert values['properties']['properties_table'][
            'Architecture'] == host.architecture.name
        assert values['properties']['properties_table'][
            'Operating System'] == os_name
        assert values['properties']['properties_table'][
            'Location'] == host.location.name
        assert values['properties']['properties_table'][
            'Organization'] == host.organization.name
        assert values['properties']['properties_table'][
            'Owner'] == values['current_user']
コード例 #49
0
def test_positive_create_with_ad(session, ldap_data):
    """Create LDAP authentication with AD

    :id: 02ca85b7-5029-4618-a835-63b002767cf7

    :steps:

        1. Create a new LDAP Auth source with AD.
        2. Fill in all the fields appropriately for AD.

    :expectedresults: Whether creating LDAP Auth with AD is successful.

    :CaseImportance: Critical
    """
    name = gen_string('alpha')
    with session:
        session.ldapauthentication.create({
            'ldap_server.name':
            name,
            'ldap_server.host':
            ldap_data['ldap_hostname'],
            'ldap_server.server_type':
            LDAP_SERVER_TYPE['UI']['ad'],
            'account.account_name':
            ldap_data['ldap_user_name'],
            'account.password':
            ldap_data['ldap_user_passwd'],
            'account.base_dn':
            ldap_data['base_dn'],
            'account.groups_base_dn':
            ldap_data['group_base_dn'],
            'attribute_mappings.login':
            LDAP_ATTR['login_ad'],
            'attribute_mappings.first_name':
            LDAP_ATTR['firstname'],
            'attribute_mappings.last_name':
            LDAP_ATTR['surname'],
            'attribute_mappings.mail':
            LDAP_ATTR['mail'],
        })
        assert session.ldapauthentication.read_table_row(name)['Name'] == name
コード例 #50
0
def test_positive_resource_vm_power_management(session, module_vmware_settings):
    """Read current VMware Compute Resource virtual machine power status and
    change it to opposite one

    :id: faeabe45-5112-43a6-bde9-f869dfb26cf5

    :expectedresults: virtual machine is powered on or powered off depending on its initial state

    :CaseLevel: Integration
    """
    cr_name = gen_string('alpha')
    vm_name = module_vmware_settings['vm_name']
    with session:
        session.computeresource.create(
            {
                'name': cr_name,
                'provider': FOREMAN_PROVIDERS['vmware'],
                'provider_content.vcenter': module_vmware_settings['vcenter'],
                'provider_content.user': module_vmware_settings['user'],
                'provider_content.password': module_vmware_settings['password'],
                'provider_content.datacenter.value': module_vmware_settings['datacenter'],
            }
        )
        assert session.computeresource.search(cr_name)[0]['Name'] == cr_name
        power_status = session.computeresource.vm_status(cr_name, vm_name)
        if power_status:
            session.computeresource.vm_poweroff(cr_name, vm_name)
        else:
            session.computeresource.vm_poweron(cr_name, vm_name)
        try:
            wait_for(
                lambda: (
                    session.browser.refresh(),
                    session.computeresource.vm_status(cr_name, vm_name),
                )[1]
                is not power_status,
                timeout=30,
                delay=2,
            )
        except TimedOutError:
            raise AssertionError('Timed out waiting for VM to toggle power state')
コード例 #51
0
ファイル: test_host.py プロジェクト: ATIX-AG/robottelo
def create_fake_host(session, host, interface_id=gen_string('alpha')):
    os_name = u'{0} {1}'.format(host.operatingsystem.name,
                                host.operatingsystem.major)
    session.host.create({
        'host.name':
        host.name,
        'host.organization':
        host.organization.name,
        'host.location':
        host.location.name,
        'host.lce':
        ENVIRONMENT,
        'host.content_view':
        DEFAULT_CV,
        'host.puppet_environment':
        host.environment.name,
        'operating_system.architecture':
        host.architecture.name,
        'operating_system.operating_system':
        os_name,
        'operating_system.media_type':
        'All Media',
        'operating_system.media':
        host.medium.name,
        'operating_system.ptable':
        host.ptable.name,
        'operating_system.root_password':
        host.root_pass,
        'interfaces.interface.interface_type':
        'Interface',
        'interfaces.interface.device_identifier':
        interface_id,
        'interfaces.interface.mac':
        host.mac,
        'interfaces.interface.domain':
        host.domain.name,
        'interfaces.interface.primary':
        True,
        'interfaces.interface.interface_additional_data.virtual_nic':
        False,
    })
コード例 #52
0
    def test_positive_list_with_non_admin_user(self,
                                               session_puppet_enabled_sat,
                                               module_puppet):
        """List all the parameters for specific puppet class by id.

        :id: 00fbf150-34fb-45d0-80e9-d5798d24a24f

        :expectedresults: Parameters listed for specific Puppet class.

        :BZ: 1391556

        :CaseImportance: Medium
        """
        password = gen_string('alpha')
        required_user_permissions = {
            'ForemanPuppet::Puppetclass': {
                'permissions': ['view_puppetclasses']
            },
            'ForemanPuppet::PuppetclassLookupKey': {
                'permissions': [
                    'view_external_parameters',
                    'create_external_parameters',
                    'edit_external_parameters',
                    'destroy_external_parameters',
                ]
            },
        }
        user = make_user({'admin': '0', 'password': password})
        role = make_role()
        add_role_permissions(role['id'], required_user_permissions)
        # Add the created and initiated role with permissions to user
        session_puppet_enabled_sat.cli.User.add_role({
            'id': user['id'],
            'role-id': role['id']
        })
        sc_params = session_puppet_enabled_sat.cli.SmartClassParameter.with_user(
            user['login'],
            password).list({'puppet-class-id': module_puppet['class']['id']})
        assert len(sc_params) > 0
        # Check that only unique results are returned
        assert len(sc_params) == len({scp['id'] for scp in sc_params})
コード例 #53
0
def test_positive_delete_with_ad(session, ldap_data):
    """Delete LDAP authentication with AD

    :steps:

        1. Create a new LDAP Auth source with AD.
        2. Delete LDAP Auth source with AD.

    :expectedresults: Whether deleting LDAP Auth with AD is successful.

    :CaseImportance: Critical
    """
    name = gen_string('alpha')
    with session:
        session.ldapauthentication.create({
            'ldap_server.name':
            name,
            'ldap_server.host':
            ldap_data['ldap_hostname'],
            'ldap_server.server_type':
            LDAP_SERVER_TYPE['UI']['ad'],
            'account.account_name':
            ldap_data['ldap_user_name'],
            'account.password':
            ldap_data['ldap_user_passwd'],
            'account.base_dn':
            ldap_data['base_dn'],
            'account.groups_base_dn':
            ldap_data['group_base_dn'],
            'attribute_mappings.login':
            LDAP_ATTR['login_ad'],
            'attribute_mappings.first_name':
            LDAP_ATTR['firstname'],
            'attribute_mappings.last_name':
            LDAP_ATTR['surname'],
            'attribute_mappings.mail':
            LDAP_ATTR['mail'],
        })
        assert session.ldapauthentication.read_table_row(name)
        session.ldapauthentication.delete(name)
        assert not session.ldapauthentication.read_table_row(name)
コード例 #54
0
    def test_positive_override(self, session_puppet_enabled_sat, module_puppet,
                               module_sc_params):
        """Override the Default Parameter value.

        :id: 25e34bac-084c-4b68-a082-822633e19f7e

        :steps:

            1.  Override the parameter.
            2.  Set the new valid Default Value.
            3.  Set puppet default value to 'Use Puppet Default'.
            4.  Submit the changes.

        :expectedresults: Parameter Value overridden with new value.

        :BZ: 1830834

        :customerscenario: true

        :CaseImportance: Medium
        """
        sc_param_id = module_sc_params['ids'].pop()
        value = gen_string('alpha')
        session_puppet_enabled_sat.cli.SmartClassParameter.update({
            'default-value':
            value,
            'omit':
            1,
            'id':
            sc_param_id,
            'override':
            1
        })
        sc_param = session_puppet_enabled_sat.cli.SmartClassParameter.info({
            'puppet-class':
            module_puppet['class']['name'],
            'id':
            sc_param_id
        })
        assert sc_param['default-value'] == value
        assert sc_param['omit'] is True
コード例 #55
0
    def test_negative_validate_default_value_with_list(
            self, session_puppet_enabled_sat, module_puppet, module_sc_params):
        """Error raised for default value not in list.

        :id: cdcafbea-612e-4b60-90de-fa0c76442bbe

        :steps:

            1.  Override the parameter.
            2.  Provide default value that doesn't matches the list of step 3.
            3.  Validate this value with list validator type and rule.
            4.  Submit the change.

        :expectedresults: Error raised for default value not in list.

        :customerscenario: true

        :CaseImportance: Medium
        """
        value = gen_string('alphanumeric')
        sc_param_id = module_sc_params['ids'].pop()
        with pytest.raises(CLIReturnCodeError):
            session_puppet_enabled_sat.cli.SmartClassParameter.update({
                'id':
                sc_param_id,
                'default-value':
                value,
                'override':
                1,
                'validator-type':
                'list',
                'validator-rule':
                '5, test',
            })
        sc_param = session_puppet_enabled_sat.cli.SmartClassParameter.info({
            'puppet-class':
            module_puppet['class']['name'],
            'id':
            sc_param_id
        })
        assert sc_param['default-value'] != value
コード例 #56
0
def test_positive_update_email_subject_prefix(setting_update):
    """Check email subject prefix is updated

    :id: c8e6b323-7b39-43d6-a9f1-5474f920bba2

    :parametrized: yes

    :expectedresults: email_subject_prefix is updated

    :CaseAutomation: Automated

    :CaseImportance: Low
    """
    email_subject_prefix_value = gen_string('alpha')
    Settings.set({
        'name': "email_subject_prefix",
        'value': email_subject_prefix_value
    })
    email_subject_prefix = Settings.list(
        {'search': 'name=email_subject_prefix'})[0]
    assert email_subject_prefix_value == email_subject_prefix['value']
コード例 #57
0
def test_negative_add_puppet_repo_to_composite(session):
    """Attempt to associate puppet repos within a composite content view

    :id: 283fa7da-ca40-4ce2-b3c5-da58ae01b8e7

    :expectedresults: User cannot create a composite content view that contains
        direct puppet repos.

    :CaseLevel: Integration
    """
    composite_name = gen_string('alpha')
    with session:
        session.contentview.create({
            'name': composite_name,
            'composite_view': True,
        })
        assert session.contentview.search(
            composite_name)[0]['Name'] == composite_name
        with raises(NavigationTriesExceeded) as context:
            session.contentview.add_puppet_module(composite_name, 'httpd')
        assert 'failed to reach [AddPuppetModule]' in str(context.value)
コード例 #58
0
def scap_content():
    oscap_content_path = settings.oscap.content_path
    _, file_name = os.path.split(oscap_content_path)
    title = 'rhel-content-{0}'.format(gen_string('alpha'))
    ssh.upload_file(
        local_file=oscap_content_path,
        remote_file="/tmp/{0}".format(file_name)
    )
    scap_info = make_scapcontent({
        'title': title,
        'scap-file': '/tmp/{0}'.format(file_name)
    })
    scap_id = scap_info['id']
    scap_info = Scapcontent.info({'id': scap_id}, output_format='json')

    scap_profile_id = [
        profile['id']
        for profile in scap_info['scap-content-profiles']
        if OSCAP_PROFILE['common'] in profile['title']
    ][0]
    return scap_id, scap_profile_id
コード例 #59
0
    def test_negative_validate_default_value_with_list(self):
        """Test variable is not created for unmatched validator type list.

        :id: dc2b6471-99d7-448b-b90a-9675baacbebe

        :steps: Attempt to create variable with default value that doesn't
            match values from validator list

        :expectedresults: Variable is not created for unmatched validator rule.

        :CaseImportance: High
        """
        with self.assertRaises(CLIReturnCodeError):
            SmartVariable.create(
                {
                    'puppet-class': self.puppet_class['name'],
                    'default-value': gen_string('alphanumeric'),
                    'validator-type': 'list',
                    'validator-rule': '5, test',
                }
            )
コード例 #60
0
ファイル: test_subnet.py プロジェクト: renzon/robottelo
    def test_positive_add_parameter(self):
        """Parameters can be created in subnet

        :id: c1dae6f4-45b1-45db-8529-d7918e41a99b

        :steps:

            1. Create Subnet with all the details
            2. Create subnet parameter with single key and single value

        :expectedresults: The parameter should be created in subnet
        """
        subnet = entities.Subnet().create()
        for name in generate_strings_list():
            with self.subTest(name):
                value = gen_string('utf8')
                subnet_param = entities.Parameter(subnet=subnet.id,
                                                  name=name,
                                                  value=value).create()
                self.assertEqual(subnet_param.name, name)
                self.assertEqual(subnet_param.value, value)