_acs-authentication__auth__self_registration (private)

 _acs-authentication__auth__self_registration

Defined in packages/acs-authentication/tcl/test/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_section aa_section (public) acs::test::http acs::test::http (public) _acs-authentication__auth__self_registration _acs-authentication__auth__self_registration _acs-authentication__auth__self_registration->aa_equals _acs-authentication__auth__self_registration->aa_log _acs-authentication__auth__self_registration->aa_log_result _acs-authentication__auth__self_registration->aa_section _acs-authentication__auth__self_registration->acs::test::http

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
        set old_allow_self_register_p [parameter::get_from_package_key  -package_key acs-authentication  -parameter AllowSelfRegister]
        try {
            set endpoint_name test__auth__self_registration
            ns_register_proc GET $endpoint_name {
                ad_unless_script_abort {
                    set user_id [auth::self_registration]
                } {
                    ns_return 200 text/plain $user_id
                }
            }

            set result [acs::test::user::create]
            set user_id [dict get $result user_id]

            aa_section "Set AllowSelfRegister to false"
            parameter::set_from_package_key  -package_key acs-authentication  -parameter AllowSelfRegister  -value false

            aa_log "Unauthenticated request"
            set d [acs::test::http  -method GET /$endpoint_name]
            acs::test::reply_has_status_code $d 302

            aa_log "Authenticated request"
            set d [acs::test::http -user_id $user_id  -method GET /$endpoint_name]
            acs::test::reply_has_status_code $d 200
            aa_equals "Response must be the supplied user_id '$user_id'"  [dict get $d body] $user_id

            aa_section "Set AllowSelfRegister to true"
            parameter::set_from_package_key  -package_key acs-authentication  -parameter AllowSelfRegister  -value true

            aa_log "Unauthenticated request"
            set d [acs::test::http  -method GET /$endpoint_name]
            acs::test::reply_has_status_code $d 200
            aa_equals "Response must be empty"  [dict get $d body] ""

            aa_log "Authenticated request"
            set d [acs::test::http -user_id $user_id  -method GET /$endpoint_name]
            acs::test::reply_has_status_code $d 200
            aa_equals "Response must be empty"  [dict get $d body] ""

        } finally {
            parameter::set_from_package_key  -package_key acs-authentication  -parameter AllowSelfRegister  -value $old_allow_self_register_p
            ns_unregister_op GET $endpoint_name
            acs_user::delete -user_id $user_id -permanent
        }
    }} {
          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__self_registration (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: