_notifications__notification_delivery_tests (private)

 _notifications__notification_delivery_tests

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

Partial Call Graph (max 5 caller/called nodes):
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) _notifications__notification_delivery_tests _notifications__notification_delivery_tests _notifications__notification_delivery_tests->aa_false _notifications__notification_delivery_tests->aa_log _notifications__notification_delivery_tests->aa_log_result _notifications__notification_delivery_tests->aa_run_with_teardown _notifications__notification_delivery_tests->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 {
            db_1row q {
                select delivery_method_id,
                       sc_impl_id,
                       short_name,
                       pretty_name
                from notification_delivery_methods
                fetch first 1 rows only
            }

            aa_false "Trying to lookup the deleted delivery method succeeds" [catch {
                notification::delivery::get_id -short_name $short_name
            } errmsg]

            aa_log "Deleting method '$short_name'"
            db_dml q {delete from notification_requests where delivery_method_id = :delivery_method_id}
            notification::delivery::delete -delivery_method_id $delivery_method_id

            aa_true "Trying to lookup the deleted delivery method fails" [catch {
                notification::delivery::get_id -short_name $short_name
            } errmsg]

            aa_log "Recreating the delivery method as a new object"
            set new_delivery_method_id [notification::delivery::new  -sc_impl_id $sc_impl_id  -short_name $short_name  -pretty_name $pretty_name]

            aa_true "The delivery method was recreated as expected " [db_0or1row q {
                select 1
                from notification_delivery_methods
                where delivery_method_id = :new_delivery_method_id
                  and sc_impl_id = :sc_impl_id
                  and short_name = :short_name
                  and pretty_name = :pretty_name
            }]

            aa_log "Deleting method '$short_name' again"
            notification::delivery::delete -delivery_method_id $new_delivery_method_id

            aa_log "Recreating the delivery method with the old id"
            notification::delivery::new  -delivery_method_id $delivery_method_id  -sc_impl_id $sc_impl_id  -short_name $short_name  -pretty_name $pretty_name

            aa_true "The delivery method was recreated as expected " [db_0or1row q {
                select 1
                from notification_delivery_methods
                where delivery_method_id = :delivery_method_id
                  and sc_impl_id = :sc_impl_id
                  and short_name = :short_name
                  and pretty_name = :pretty_name
            }]
        }
    }} {
          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" "notification_delivery_tests (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: