_acs-mail-lite__email_send (private)

 _acs-mail-lite__email_send

Defined in packages/acs-mail-lite/tcl/test/acs-mail-lite-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_section aa_section (public) _acs-mail-lite__email_send _acs-mail-lite__email_send _acs-mail-lite__email_send->aa_false _acs-mail-lite__email_send->aa_log _acs-mail-lite__email_send->aa_log_result _acs-mail-lite__email_send->aa_run_with_teardown _acs-mail-lite__email_send->aa_section

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        aa_run_with_teardown -test_code {

            set package_id [apm_package_id_from_key "acs-mail-lite"]
            set orig_send_immediately_p [parameter::get  -package_id $package_id  -parameter "send_immediately"  -default 0]
            parameter::set_value  -package_id $package_id  -parameter "send_immediately"  -value 0

            set any_object_id [db_string get_any_object {
                select max(object_id) from acs_objects
            }]

            set sender_info [acs::test::user::create]
            set recipient_info [acs::test::user::create]
            set from_addr [dict get $sender_info email]
            set to_addr [dict get $recipient_info email]


            aa_section "Scheduled sending"

            set subject {Test scheduled subject}
            set body {Test scheduled body}

            acs_mail_lite::send  -to_addr $to_addr  -from_addr $from_addr  -subject $subject  -body $body  -object_id $any_object_id

            aa_true "Mail was scheduled for sending" [db_0or1row check_scheduled {
                select 1 from acs_mail_lite_queue
                where object_id = :any_object_id
                and to_addr = :to_addr
                and from_addr = :from_addr
                and subject = :subject
                and body = :body
            }]

            set subject {Test immediate subject}
            set body {Test immediate body}


            aa_section "Immediate sending"

            acs_mail_lite::send  -to_addr $to_addr  -from_addr $from_addr  -subject $subject  -body $body  -object_id $any_object_id  -send_immediately

            set recipient_id [dict get $recipient_info user_id]

            aa_false "Mail was NOT scheduled for sending" [db_0or1row check_scheduled {
                select 1 from acs_mail_lite_queue
                where object_id = :any_object_id
                and to_addr = :to_addr
                and from_addr = :from_addr
                and subject = :subject
                and body = :body
            }]

            aa_true "A unique id was assigned to the message" [db_0or1row check_id {
                select 1 from acs_mail_lite_send_msg_id_map
                where object_id = :any_object_id
                and package_id = :package_id
                and party_id = :recipient_id
            }]

        } -teardown_code {
            parameter::set_value  -package_id $package_id  -parameter "send_immediately"  -value $orig_send_immediately_p

            if {[info exists sender_info]} {
                acs::test::user::delete -user_id [dict get $sender_info user_id]
            }
            if {[info exists recipient_info]} {
                acs::test::user::delete -user_id [dict get $recipient_info user_id]
            }
        }
    }} {
          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" "email_send (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: