_attachments__attachments_map_folder (private)

 _attachments__attachments_map_folder

Defined in packages/attachments/tcl/test/attachments-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_false aa_false (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) aa_true aa_true (public) _attachments__attachments_map_folder _attachments__attachments_map_folder _attachments__attachments_map_folder->aa_false _attachments__attachments_map_folder->aa_log _attachments__attachments_map_folder->aa_log_result _attachments__attachments_map_folder->aa_run_with_teardown _attachments__attachments_map_folder->aa_true

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    aa_run_with_teardown -rollback -test_code {
        set package_id [db_string get_a_package {
            select max(package_id) from apm_packages p
            where not exists (select 1 from attachments_fs_root_folder_map
                              where package_id = p.package_id)
        } -default ""]
        set folder_id [db_string get_a_folder {
            select max(folder_id) from fs_root_folders f
            where not exists (select 1 from attachments_fs_root_folder_map
                              where folder_id = f.folder_id)
        } -default ""]
        if { $package_id ne "" && $folder_id ne "" } {

            aa_false "Package does not refer to a root_folder"  [attachments::root_folder_p -package_id $package_id]

            aa_log "Mapping package '$package_id' to folder '$folder_id'"
            attachments::map_root_folder  -package_id $package_id  -folder_id $folder_id

            aa_true "Package now refers to a root_folder"  [attachments::root_folder_p -package_id $package_id]

            aa_true "A mapping was inserted" [db_0or1row check {
                select 1 from attachments_fs_root_folder_map
                where package_id = :package_id and folder_id = :folder_id
            }]

            aa_log "Remove the mapping"
            attachments::unmap_root_folder  -package_id $package_id  -folder_id $folder_id

            aa_false "Package does not refer to a root_folder anymore"  [attachments::root_folder_p -package_id $package_id]
        } else {
            aa_log "Cannot test mapping, not package or root folders to choose."
        }
    }
}} {
          aa_log "Running testcase body $body_count"
          set ::__aa_test_indent [info level]
          set catch_val [catch $testcase_body msg]
          if {$catch_val != 0 && $catch_val != 2} {
              aa_log_result "fail" "attachments_map_folder (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo"
          }
          incr body_count
        }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: