コード例 #1
0
def verify_error_msg_for_duplicate_scope(*scopes_obj):

    logger.info("Create and verify Scope")
    navigate()
    if isinstance(scopes_obj, test_data.DataObj):
        scopes_obj = [scopes_obj]
    elif isinstance(scopes_obj, tuple):
        scopes_obj = list(scopes_obj[0])
    for scope in scopes_obj:
        have_resource = False
        CreateScopes.click_create_scope_button()
        logger.info("Creating scope %s" % scope.name)
        CreateScopes.wait_create_scope_dialog_open()
        CreateScopes.input_name(scope.name)
        if hasattr(scope, 'description'):
            CreateScopes.input_description(scope.description)
        if hasattr(scope, 'resources'):
            for resource in enumerate(scope.resources):
                have_resource = True
                _Add_Resource_To_Scope_Add(resource)
        CreateScopes.click_create_plus_button()

        validate_msg = CommonOperationScopes.get_scopename_validate_message()
        err_msg = CommonOperationScopes.get_scope_error_message()
        CreateScopes.click_cancel_button()
        CreateScopes.wait_create_scope_dialog_close()
        if validate_msg is not None:
            return validate_msg
        if err_msg is not None:
            return err_msg
        else:
            return FusionUIBase.fail_test_or_return_false("Failed to find the element")
コード例 #2
0
def edit_verify_scope(*scope_obj):
    """ Edit Scope    """
    logger.info("Edit and Verify Scope")
    navigate()
    if isinstance(scope_obj, test_data.DataObj):
        scope_obj = [scope_obj]
    elif isinstance(scope_obj, tuple):
        scope_obj = list(scope_obj[0])
    fail_if_exist = 0
    #    Looping to edit all the resources present in the resources.txt file
    for scope in scope_obj:
        logger.info("Editing scope %s" % scope.name)
        if scope.has_property("new_name"):
            if scope.new_name != scope.name and VerifyScopes.verify_scope_existed(scope.new_name, 5, False):
                fail_if_exist += 1
                logger.warn("scope %s already exists, can't edit scope" % scope.new_name)
                continue
        #    Selecting the given scope
        if CommonOperationScopes.select_scope(scope.name):
            #    Clicking on edit button and verifying the edit options page
            CommonOperationScopes.wait_for_scopes_load()
            EditScopes.click_edit_scope_button()
            EditScopes.wait_edit_scope_dialog_open()
            if scope.has_property("new_name"):
                data = _Verify_Parameter(scope.new_name, "Scope Name")
                if not (data == "none" or data == ""):
                    EditScopes.input_name(data)
    EditScopes.click_ok_button()

    validate_msg = CommonOperationScopes.get_scopename_validate_message()
    EditScopes.click_cancel_button()
    EditScopes.wait_edit_scope_dialog_close()
    if validate_msg is None and fail_if_exist == 0:
        FusionUIBase.fail_test_or_return_false("Failed to find the required element")
    else:
        return validate_msg