Beispiel #1
0
def test_provider_add_with_bad_credentials(provider):
    """Tests provider add with bad credentials

    Metadata:
        test_flag: crud
    """
    provider.credentials['default'] = provider.Credential(
        principal='bad',
        secret='reallybad',
        verify_secret='reallybad'
    )
    if isinstance(provider, VMwareProvider):
        with error.expected('Cannot complete login due to an incorrect user name or password.'):
            provider.create(validate_credentials=True)
    elif isinstance(provider, RHEVMProvider):
        error_message = version.pick(
            {'5.4': '401 Unauthorized',
             '5.5': 'Credential validation was not successful: '
                'Login failed due to a bad username or password.',
             '5.6': 'Credential validation was not successful: '
                'Incorrect user name or password.',
        }
        )
        with error.expected(error_message):
            provider.create(validate_credentials=True)
Beispiel #2
0
def test_provider_add_with_bad_credentials(provider_crud):
    provider_crud.credentials = provider.get_credentials_from_config('bad_credentials')
    if isinstance(provider_crud, provider.VMwareProvider):
        with error.expected('Cannot complete login due to an incorrect user name or password.'):
            provider_crud.create(validate_credentials=True)
    elif isinstance(provider_crud, provider.RHEVMProvider):
        with error.expected('401 Unauthorized'):
            provider_crud.create(validate_credentials=True)
def test_delete_template(rest_api, template, multiple):
    if multiple:
        rest_api.collections.templates.action.delete(template)
        with error.expected("ActiveRecord::RecordNotFound"):
            rest_api.collections.templates.action.delete(template)
    else:
        template.action.delete()
        with error.expected("ActiveRecord::RecordNotFound"):
            template.action.delete()
 def test_delete_groups(self, rest_api, groups, multiple):
     if multiple:
         rest_api.collections.groups.action.delete(*groups)
         with error.expected("ActiveRecord::RecordNotFound"):
             rest_api.collections.groups.action.delete(*groups)
     else:
         group = groups[0]
         group.action.delete()
         with error.expected("ActiveRecord::RecordNotFound"):
             group.action.delete()
 def test_delete_user(self, rest_api, users, multiple):
     if multiple:
         rest_api.collections.users.action.delete(*users)
         with error.expected("ActiveRecord::RecordNotFound"):
             rest_api.collections.users.action.delete(*users)
     else:
         user = users[0]
         user.action.delete()
         with error.expected("ActiveRecord::RecordNotFound"):
             user.action.delete()
 def test_delete_tenants(self, rest_api, tenants, multiple):
     if multiple:
         rest_api.collections.tenants.action.delete(*tenants)
         with error.expected("ActiveRecord::RecordNotFound"):
             rest_api.collections.tenants.action.delete(*tenants)
     else:
         tenant = tenants[0]
         tenant.action.delete()
         with error.expected("ActiveRecord::RecordNotFound"):
             tenant.action.delete()
Beispiel #7
0
 def test_delete_tags(self, rest_api, tags, multiple):
     if multiple:
         rest_api.collections.tags.action.delete(*tags)
         with error.expected("ActiveRecord::RecordNotFound"):
             rest_api.collections.tags.action.delete(*tags)
     else:
         tag = tags[0]
         tag.action.delete()
         with error.expected("ActiveRecord::RecordNotFound"):
             tag.action.delete()
Beispiel #8
0
def test_delete_rates(rest_api, rates, multiple):
    if multiple:
        rest_api.collections.rates.action.delete(*rates)
        with error.expected("ActiveRecord::RecordNotFound"):
            rest_api.collections.rates.action.delete(*rates)
    else:
        rate = rates[0]
        rate.action.delete()
        with error.expected("ActiveRecord::RecordNotFound"):
            rate.action.delete()
 def test_delete_custom_attributes(self, rest_api, custom_attributes, from_detail):
     """Test deleting custom attributes using REST API."""
     if from_detail:
         for ent in custom_attributes:
             ent.action.delete()
             with error.expected("ActiveRecord::RecordNotFound"):
                 ent.action.delete()
     else:
         provider = rest_api.collections.providers[0]
         provider.custom_attributes.action.delete(*custom_attributes)
         with error.expected("ActiveRecord::RecordNotFound"):
             provider.custom_attributes.action.delete(*custom_attributes)
Beispiel #10
0
def test_delete_categories(rest_api, categories, multiple):
    if "delete" not in rest_api.collections.categories.action.all:
        pytest.skip("Delete categories action is not implemented in this version")

    if multiple:
        rest_api.collections.categories.action.delete(*categories)
        with error.expected("ActiveRecord::RecordNotFound"):
            rest_api.collections.categories.action.delete(*categories)
    else:
        ctg = categories[0]
        ctg.action.delete()
        with error.expected("ActiveRecord::RecordNotFound"):
            ctg.action.delete()
def test_provider_add_with_bad_credentials(provider):
    """Tests provider add with bad credentials

    Metadata:
        test_flag: crud
    """
    provider.credentials['default'] = get_credentials_from_config('bad_credentials')
    if isinstance(provider, VMwareProvider):
        with error.expected('Cannot complete login due to an incorrect user name or password.'):
            provider.create(validate_credentials=True)
    elif isinstance(provider, RHEVMProvider):
        with error.expected('401 Unauthorized'):
            provider.create(validate_credentials=True)
Beispiel #12
0
def test_region_required_validation(request, soft_assert):
    """Tests to validate the region while adding a provider"""
    prov = EC2Provider(
        name=fauxfactory.gen_alphanumeric(5),
        region=None)

    request.addfinalizer(prov.delete_if_exists)
    if version.current_version() < "5.5":
        with error.expected('Region is not included in the list'):
            prov.create()
    else:
        with error.expected(FlashMessageException):
            prov.create()
        soft_assert("ng-invalid-required" in properties_form.amazon_region_select.classes)
def test_name_required_validation(request):
    """Tests to validate the name while adding a provider"""
    prov = EC2Provider(
        name=None,
        region='us-east-1')

    request.addfinalizer(prov.delete_if_exists)
    if version.current_version() < "5.5":
        with error.expected("Name can't be blank"):
            prov.create()
    else:
        # It must raise an exception because it keeps on the form
        with error.expected(FlashMessageException):
            prov.create()
        assert prov.properties_form.name_text.angular_help_block == "Required"
def test_delete_dialog_before_parent_item(appliance, catalog_item):
    service_dialog = DialogCollection(appliance)
    dialog = service_dialog.instantiate(label=catalog_item.dialog.label)
    error_message = ('Dialog \"{}\": Error during delete: Dialog cannot be'
        ' deleted because it is connected to other components.').format(catalog_item.dialog.label)
    with error.expected(error_message):
        dialog.delete()
def test_host_name_required_validation(request):
    """Test to validate the hostname while adding a provider"""
    prov = OpenStackProvider(
        name=fauxfactory.gen_alphanumeric(5),
        hostname=None,
        ip_address=fauxfactory.gen_ipaddr(prefix=[10]))

    request.addfinalizer(prov.delete_if_exists)
    if version.current_version() < "5.5":
        with error.expected("Host Name can't be blank"):
            prov.create()
    else:
        # It must raise an exception because it keeps on the form
        with error.expected(FlashMessageException):
            prov.create()
        assert prov.properties_form.hostname_text.angular_help_block == "Required"
Beispiel #16
0
def test_description_required_error_validation():
    tp = st.Timeprofile(
        description=None,
        scope='Current User',
        timezone="(GMT-10:00) Hawaii")
    with error.expected("Description is required"):
        tp.create()
def test_permissions(appliance, role, allowed_actions, disallowed_actions):
    # create a user and role
    role = role()  # call function to get role
    role.create()
    group = new_group(role=role.name)
    group.create()
    user = new_user(group=group)
    user.create()
    fails = {}
    try:
        with user:
            appliance.server.login_admin()
            for name, action_thunk in allowed_actions.items():
                try:
                    action_thunk()
                except Exception:
                    fails[name] = "{}: {}".format(name, traceback.format_exc())
            for name, action_thunk in disallowed_actions.items():
                try:
                    with error.expected(Exception):
                        action_thunk()
                except error.UnexpectedSuccessException:
                    fails[name] = "{}: {}".format(name, traceback.format_exc())
            if fails:
                message = ''
                for failure in fails.values():
                    message = "{}\n\n{}".format(message, failure)
                raise Exception(message)
    finally:
        appliance.server.login_admin()
Beispiel #18
0
def test_delete_roles(rest_api, roles):
    if "delete" not in rest_api.collections.roles.action.all:
        pytest.skip("Delete roles action is not implemented in this version")

    rest_api.collections.roles.action.delete(*roles)
    with error.expected("ActiveRecord::RecordNotFound"):
        rest_api.collections.roles.action.delete(*roles)
Beispiel #19
0
def test_type_required_validation(request):
    """Test to validate type while adding a provider"""
    prov = provider.Provider()

    request.addfinalizer(prov.delete_if_exists)
    with error.expected('Type is required'):
        prov.create()
def test_tenant_unique_tenant_project_name_on_parent_level(request, object_type):
    """Tenant or Project has always unique name on parent level. Same name cannot be used twice.

    Prerequisities:
        * This test is not depending on any other test and can be executed against fresh appliance.

    Steps:
        * Create tenant or project
        * Create another tenant or project with the same name
        * Creation will fail because object with the same name exists
        * Delete created objects
    """

    name_of_tenant = object_type.__name__ + fauxfactory.gen_alphanumeric()
    tenant_description = object_type.__name__ + 'description'

    tenant = object_type(
        name=name_of_tenant,
        description=tenant_description)

    tenant2 = object_type(
        name=name_of_tenant,
        description=tenant_description)

    @request.addfinalizer
    def _delete_tenant():
        if tenant.exists:
            tenant.delete()
        if tenant2.exists:
            tenant2.delete()

    tenant.create()
    with error.expected("Validation failed: Name should be unique per parent"):
        tenant2.create()
    tenant.delete()
Beispiel #21
0
def test_catalog_duplicate_name():
    cat = Catalog(name=rand.generate_random_string(),
                  description="my catalog")
    cat.create()
    with error.expected("Name has already been taken"):
        cat.create()
    cat.delete()
def test_permissions(role, allowed_actions, disallowed_actions):
    # create a user and role
    role = role()  # call function to get role
    role.create()
    group = new_group(role=role.name)
    group.create()
    user = new_user(group=group)
    user.create()
    fails = {}
    try:
        login.login(user.credential.principal, user.credential.secret)
        for name, action_thunk in allowed_actions.items():
            try:
                action_thunk()
            except Exception:
                fails[name] = "%s: %s" % (name, traceback.format_exc())
        for name, action_thunk in disallowed_actions.items():
            try:
                with error.expected(Exception):
                    action_thunk()
            except error.UnexpectedSuccessException:
                fails[name] = "%s: %s" % (name, traceback.format_exc())
        if fails:
            message = ''
            for failure in fails.values():
                message = "%s\n\n%s" % (message, failure)
            raise Exception(message)
    finally:
        login.login_admin()
Beispiel #23
0
def test_provider_add_with_bad_port(provider):
    """ Tests provider add with bad port (incorrect)"""
    provider.port = 8888
    with error.expected('Credential validation was not successful: Unable to connect to {}:8888'
                        .format(provider.hostname)):
        with sel.ajax_timeout(120):
            provider.create(validate_credentials=True)
def test_name_required_error_validation():
    """
    Tests a System Image with no name.
    """
    sys_image_type = pxe.SystemImageType(name=None, provision_type="Vm")
    with error.expected("Name is required"):
        sys_image_type.create()
Beispiel #25
0
def test_catalog_duplicate_name():
    cat = Catalog(name=fauxfactory.gen_alphanumeric(),
                  description="my catalog")
    cat.create()
    with error.expected("Name has already been taken"):
        cat.create()
    cat.delete()
def test_permission_edit(request, product_features, action):
    """
    Ensures that changes in permissions are enforced on next login
    """
    request.addfinalizer(login.login_admin)
    role_name = fauxfactory.gen_alphanumeric()
    role = ac.Role(name=role_name,
                  vm_restriction=None,
                  product_features=[(['Everything'], False)] +    # role_features
                                   [(k, True) for k in product_features])
    role.create()
    group = new_group(role=role.name)
    group.create()
    user = new_user(group=group)
    user.create()
    login.login(user.credential.principal, user.credential.secret)
    try:
        action()
    except Exception:
        pytest.fail('Incorrect permissions set')
    login.login_admin()
    role.update({'product_features': [(['Everything'], True)] +
                                     [(k, False) for k in product_features]
                 })
    login.login(user.credential.principal, user.credential.secret)
    try:
        with error.expected(Exception):
            action()
    except error.UnexpectedSuccessException:
        pytest.Fails('Permissions have not been updated')
def test_analysis_profile_duplicate_name():
    """ Test to validate duplicate profiles name."""
    p = VMAnalysisProfile(
        fauxfactory.gen_alphanumeric(), fauxfactory.gen_alphanumeric(), categories=["check_system"])
    p.create()
    with error.expected("Name has already been taken"):
        p.create()
def test_current_user_login_delete(request):
    """Test for deleting current user login.

    Steps:
        * Login as Admin user
        * Create a new user
        * Login with the new user
        * Try deleting the user
    """
    group_user = Group("EvmGroup-super_administrator")
    user = User(
        name='user' + fauxfactory.gen_alphanumeric(),
        credential=new_credential(),
        email='*****@*****.**',
        group=group_user)
    user.create()
    request.addfinalizer(user.delete)
    request.addfinalizer(login.login_admin)
    with user:
        if version.current_version() >= '5.7':
            navigate_to(user, 'Details')
            menu_item = ('Configuration', 'Delete this User')
            assert tb.exists(*menu_item) and tb.is_greyed(*menu_item), "Delete User is not dimmed"
        else:
            with error.expected("Current EVM User \"{}\" cannot be deleted".format(user.name)):
                user.delete()
def test_permission_edit(request, product_features, action):
    """
    Ensures that changes in permissions are enforced on next login
    """
    product_features = version.pick(product_features)
    request.addfinalizer(login.login_admin)
    role_name = fauxfactory.gen_alphanumeric()
    role = ac.Role(
        name=role_name,
        vm_restriction=None,
        product_features=[(["Everything"], False)] + [(k, True) for k in product_features],  # role_features
    )
    role.create()
    group = new_group(role=role.name)
    group.create()
    user = new_user(group=group)
    user.create()
    with user:
        try:
            action()
        except Exception:
            pytest.fail("Incorrect permissions set")
    login.login_admin()
    role.update({"product_features": [(["Everything"], True)] + [(k, False) for k in product_features]})
    with user:
        try:
            with error.expected(Exception):
                action()
        except error.UnexpectedSuccessException:
            pytest.Fails("Permissions have not been updated")
Beispiel #30
0
def test_timeprofile_duplicate_name():
    nt = new_timeprofile()
    nt.create()
    msg = "Error during 'add': Validation failed: Description has already been taken"
    with error.expected(msg):
        nt.create()
    nt. delete()
def test_domain_name_wrong():
    domains = DomainCollection()
    with error.expected('Name may contain only'):
        domains.create(name='with space')
Beispiel #32
0
def test_drift_analysis(request, provider, instance, soft_assert):
    """ Tests drift analysis is correct

    Metadata:
        test_flag: vm_analysis
    """

    instance.load_details()
    drift_num_orig = 0
    drift_orig = InfoBlock("Relationships", "Drift History").text
    if drift_orig != 'None':
        drift_num_orig = int(drift_orig)
    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="15m",
             fail_func=lambda: toolbar.select('Reload'))
    instance.load_details()
    wait_for(lambda: int(InfoBlock("Relationships", "Drift History").text) ==
             drift_num_orig + 1,
             delay=20,
             num_sec=120,
             message="Waiting for Drift History count to increase",
             fail_func=sel.refresh)
    drift_new = int(InfoBlock("Relationships", "Drift History").text)

    # add a tag and a finalizer to remove it
    tag = ('Department', 'Accounting')
    instance.add_tag(tag, single_value=False)
    request.addfinalizer(lambda: instance.remove_tag(tag))

    instance.smartstate_scan()
    wait_for(lambda: is_vm_analysis_finished(instance.name),
             delay=15,
             timeout="15m",
             fail_func=lambda: toolbar.select('Reload'))
    instance.load_details()
    wait_for(lambda: int(InfoBlock("Relationships", "Drift History").text) ==
             drift_new + 1,
             delay=20,
             num_sec=120,
             message="Waiting for Drift History count to increase",
             fail_func=sel.refresh)

    # check drift difference
    soft_assert(
        not instance.equal_drift_results('Department (1)', 'My Company Tags',
                                         0, 1),
        "Drift analysis results are equal when they shouldn't be")

    # Test UI features that modify the drift grid
    d_grid = DriftGrid()

    # Accounting tag should not be displayed, because it was changed to True
    toolbar.select("Attributes with same values")
    with error.expected(sel.NoSuchElementException):
        d_grid.get_cell('Accounting', 0)

    # Accounting tag should be displayed now
    toolbar.select("Attributes with different values")
    d_grid.get_cell('Accounting', 0)
Beispiel #33
0
def test_bad_password():
    """ Tests logging in with a bad password. """
    pytest.sel.get(pytest.sel.base_url())
    with error.expected('Sorry, the username or password you entered is incorrect.'):
        login.login(conf.credentials['default']['username'], "badpassword@#$")
    assert login.page.is_displayed()
def test_group_duplicate_name():
    group = new_group()
    group.create()
    with error.expected("Description has already been taken"):
        group.create()
Beispiel #35
0
def test_duplicate_disallowed(an_instance):
    an_instance.create()
    with error.expected("Name has already been taken"):
        an_instance.create(allow_duplicate=True)
Beispiel #36
0
def test_duplicate_class_disallowed(a_class):
    a_class.create()
    with error.expected("Name has already been taken"):
        a_class.create(allow_duplicate=True)
Beispiel #37
0
def test_catalog_item_duplicate_name(catalog_item):
    catalog_item.create()
    with error.expected("Name has already been taken"):
        catalog_item.create()
Beispiel #38
0
def test_compute_chargeback_duplicate_disallowed(chargeback_compute_rate):
    chargeback_compute_rate.create()
    with error.expected('Description has already been taken'):
        chargeback_compute_rate.create()
def test_analysis_profile_name_validation():
    """ Test to validate profile name."""
    p = HostAnalysisProfile(None, fauxfactory.gen_alphanumeric(), files=["asdf", "dfg"])
    with error.expected("Name can't be blank"):
        p.create()
def test_rolename_duplicate_validation():
    role = new_role()
    role.create()
    with error.expected("Name has already been taken"):
        role.create()
def test_rolename_required_error_validation():
    role = ac.Role(
        name=None,
        vm_restriction='Only User Owned')
    with error.expected("Name can't be blank"):
        role.create()
def test_description_required_error_validation():
    group = ac.Group(description=None, role='EvmRole-approver')
    with error.expected("Description can't be blank"):
        group.create()
def test_duplicate_namespace_disallowed(namespace):
    namespace.create()
    with error.expected(
            "Error during 'add': Validation failed: fqname must be unique"):
        namespace.create()
def test_type_required_validation():
    """Test to validate type while adding a provider"""
    prov = Provider()
    with error.expected('Type is required'):
        prov.create()
def test_delete_catalog_item_deletes_service(catalog_item):
    catalog_item.delete()
    service_catalogs = ServiceCatalogs(catalog_item.catalog, catalog_item.name)
    with error.expected(NoSuchElementException):
        service_catalogs.order()
def test_duplicate_method_disallowed(a_method):
    a_method.create()
    with error.expected("Name has already been taken"):
        a_method.create()
Beispiel #47
0
def test_config_manager_add_invalid_creds(request, config_manager_obj):
    request.addfinalizer(config_manager_obj.delete)
    config_manager_obj.credentials.principal = 'invalid_user'
    with error.expected('Invalid username/password'):
        config_manager_obj.create()
Beispiel #48
0
def test_duplicate_namespace_disallowed(namespace):
    namespace.create()
    with error.expected("Name has already been taken"):
        namespace.create(allow_duplicate=True)
Beispiel #49
0
def test_host_drift_analysis(request, setup_provider, provider, host_type,
                             host_name, soft_assert):
    """Tests host drift analysis

    Metadata:
        test_flag: host_drift_analysis
    """
    host_data = get_host_data_by_name(provider.key, host_name)
    test_host = host.Host(name=host_name)

    wait_for(lambda: test_host.exists,
             delay=10,
             num_sec=120,
             fail_func=sel.refresh,
             message="hosts_exists")

    # get drift history num
    drift_num_orig = int(test_host.get_detail('Relationships',
                                              'Drift History'))

    # add credentials to host + finalizer to remove them
    if not test_host.has_valid_credentials:
        test_host.update(updates={
            'credentials':
            host.get_credentials_from_config(host_data['credentials'])
        },
                         validate_credentials=True)

        @request.addfinalizer
        def test_host_remove_creds():
            test_host.update(
                updates={
                    'credentials':
                    host.Host.Credential(
                        principal="", secret="", verify_secret="")
                })

    # initiate 1st analysis
    test_host.run_smartstate_analysis()

    # Wait for the task to finish
    def is_host_analysis_finished():
        """ Check if analysis is finished - if not, reload page
        """
        if not sel.is_displayed(tasks.tasks_table) or not tabs.is_tab_selected(
                'All Other Tasks'):
            sel.force_navigate('tasks_all_other')
        host_analysis_finished = tasks.tasks_table.find_row_by_cells({
            'task_name':
            "SmartState Analysis for '{}'".format(host_name),
            'state':
            'Finished'
        })
        if host_analysis_finished:
            # Delete the task
            tasks.tasks_table.select_row_by_cells({
                'task_name':
                "SmartState Analysis for '{}'".format(host_name),
                'state':
                'Finished'
            })
            tb.select('Delete Tasks', 'Delete', invokes_alert=True)
            sel.handle_alert()
        return host_analysis_finished is not None

    wait_for(is_host_analysis_finished,
             delay=15,
             timeout="8m",
             fail_func=lambda: tb.select('Reload'))

    # wait for for drift history num+1
    wait_for(lambda: int(test_host.get_detail('Relationships', 'Drift History')
                         ) == drift_num_orig + 1,
             delay=20,
             num_sec=120,
             message="Waiting for Drift History count to increase",
             fail_func=sel.refresh)

    # add a tag and a finalizer to remove it
    tag = ('Department', 'Accounting')
    test_host.tag(tag, single_value=False)
    request.addfinalizer(lambda: test_host.untag(tag))

    # initiate 2nd analysis
    test_host.run_smartstate_analysis()

    # Wait for the task to finish
    wait_for(is_host_analysis_finished,
             delay=15,
             timeout="8m",
             fail_func=lambda: tb.select('Reload'))

    # wait for for drift history num+2
    wait_for(lambda: int(test_host.get_detail('Relationships', 'Drift History')
                         ) == drift_num_orig + 2,
             delay=20,
             num_sec=120,
             message="Waiting for Drift History count to increase",
             fail_func=sel.refresh)

    # check drift difference
    soft_assert(
        not test_host.equal_drift_results('Department (1)', 'My Company Tags',
                                          0, 1),
        "Drift analysis results are equal when they shouldn't be")

    # Test UI features that modify the drift grid
    d_grid = DriftGrid()

    # Accounting tag should not be displayed, because it was changed to True
    tb.select("Attributes with same values")
    with error.expected(sel.NoSuchElementException):
        d_grid.get_cell('Accounting', 0)

    # Accounting tag should be displayed now
    tb.select("Attributes with different values")
    d_grid.get_cell('Accounting', 0)
def test_delete_catalog_item_deletes_service(catalog_item):
    catalog_item.delete()
    service_catalogs = ServiceCatalogs("service_name")
    with error.expected(CandidateNotFound):
        service_catalogs.order(catalog_item.catalog, catalog_item)
Beispiel #51
0
def test_description_required_error_validation():
    tp = st.Timeprofile(description=None,
                        scope='Current User',
                        timezone="(GMT-10:00) Hawaii")
    with error.expected("Description is required"):
        tp.create()
def test_analysis_profile_description_validation():
    """ Test to validate profile description."""
    p = HostAnalysisProfile(fauxfactory.gen_alphanumeric(), None, files=["asdf", "dfg"])
    with error.expected("Description can't be blank"):
        p.create()
Beispiel #53
0
def test_config_manager_add_invalid_url(request, config_manager_obj):
    request.addfinalizer(config_manager_obj.delete)
    config_manager_obj.url = "invalid_url"
    with error.expected('bad hostname'):
        config_manager_obj.create()
Beispiel #54
0
 def test_delete_services(self, rest_api, services):
     rest_api.collections.services.action.delete(*services)
     with error.expected("ActiveRecord::RecordNotFound"):
         rest_api.collections.services.action.delete(*services)
Beispiel #55
0
 def test_delete_service(self, rest_api, services):
     service = rest_api.collections.services[0]
     service.action.delete()
     with error.expected("ActiveRecord::RecordNotFound"):
         service.action.delete()
def test_description_required_error_validation():
    error_text = "Description can't be blank"
    group = Group(description=None, role='EvmRole-approver')
    with error.expected(error_text):
        group.create()
    flash.dismiss()
def test_delete_default_roles():
    flash_msg = \
        'Role "{}": Error during \'destroy\': Cannot delete record because of dependent miq_groups'
    role = ac.Role(name='EvmRole-approver')
    with error.expected(flash_msg.format(role.name)):
        role.delete()
Beispiel #58
0
def test_duplicate_class_disallowed(namespace):
    name = fauxfactory.gen_alphanumeric()
    namespace.classes.create(name=name)
    with error.expected("Name has already been taken"):
        namespace.classes.create(name=name)
def test_user_duplicate_name():
    nu = new_user()
    nu.create()
    with error.expected("Userid has already been taken"):
        nu.create()
def test_analysis_profile_item_validation():
    """ Test to validate analysis profile items."""
    p = HostAnalysisProfile(
        fauxfactory.gen_alphanumeric(), fauxfactory.gen_alphanumeric(), files=None)
    with error.expected("At least one item must be entered to create Analysis Profile"):
        p.create()