_acs-authentication__auth_email_on_password_change (private)

 _acs-authentication__auth_email_on_password_change

Defined in packages/acs-authentication/tcl/test/acs-authentication-procs.tcl

Partial Call Graph (max 5 caller/called nodes):
%3 aa_equals aa_equals (public) aa_log aa_log (public) aa_log_result aa_log_result (public) aa_run_with_teardown aa_run_with_teardown (public) aa_stub aa_stub (public) _acs-authentication__auth_email_on_password_change _acs-authentication__auth_email_on_password_change _acs-authentication__auth_email_on_password_change->aa_equals _acs-authentication__auth_email_on_password_change->aa_log _acs-authentication__auth_email_on_password_change->aa_log_result _acs-authentication__auth_email_on_password_change->aa_run_with_teardown _acs-authentication__auth_email_on_password_change->aa_stub

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    aa_stub acs_mail_lite::send {
        set ::ns_sendmail_to $to_addr
    }

    aa_run_with_teardown  -rollback  -test_code {
            parameter::set_value -parameter EmailAccountOwnerOnPasswordChangeP -package_id [ad_acs_kernel_id] -value 1

            set ::ns_sendmail_to {}

            array set result [acs::test::user::create]
            set user [acs_user::get_user_info -user_id $result(user_id)]
            set authority_id [dict get $user authority_id]
            set username     [dict get $user username]
            set email        $result(email)
            set password     $result(password)

            aa_equals "Create user OK" $result(creation_status) "ok"

            set user_id $result(user_id)

            aa_equals "Authority from api is correct" [db_string sel { select authority_id from users where user_id = :user_id }] $authority_id

            # Change password
            array unset result
            set new_password [ad_generate_random_string]
            array set result [auth::password::change  -user_id $user_id  -old_password $password  -new_password $new_password]
            if { ![aa_equals "Password change OK" $result(password_status) "ok"] } {
                aa_log "Message was: $result(password_message)"
            }

            # Check that we get email
            aa_equals "Email sent to user" [string tolower $::ns_sendmail_to] [string tolower $email]
            set ::ns_sendmail_to {ns_sendmail_UNCALLED}

            # Set parameter to false
            parameter::set_value -parameter EmailAccountOwnerOnPasswordChangeP -package_id [ad_acs_kernel_id] -value 0

            # Change password
            array unset result
            set new_new_password [ad_generate_random_string]
            array set result [auth::password::change  -user_id $user_id  -old_password $new_password  -new_password $new_new_password]
            aa_equals "Password change OK" $result(password_status) "ok"

            # Check that we do not get an email
            aa_equals "Email NOT sent to user" $::ns_sendmail_to {ns_sendmail_UNCALLED}

            ad_parameter_cache -delete [ad_acs_kernel_id] EmailAccountOwnerOnPasswordChangeP
        }
}} {
          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" "auth_email_on_password_change (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: