_acs-authentication__auth_use_email_for_login_p (private)

 _acs-authentication__auth_use_email_for_login_p

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_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) _acs-authentication__auth_use_email_for_login_p _acs-authentication__auth_use_email_for_login_p _acs-authentication__auth_use_email_for_login_p->aa_equals _acs-authentication__auth_use_email_for_login_p->aa_false _acs-authentication__auth_use_email_for_login_p->aa_log _acs-authentication__auth_use_email_for_login_p->aa_log_result _acs-authentication__auth_use_email_for_login_p->aa_run_with_teardown

Testcases:
No testcase defined.
Source code:
        
        set _aa_export {}
        set body_count 1
        foreach testcase_body {{
    aa_stub auth::get_register_authority {
        return [auth::authority::get_id -short_name "acs_testing"]
    }

    aa_run_with_teardown  -rollback  -test_code {
            # Test various values to see that it doesn't break

            parameter::set_value -parameter UseEmailForLoginP -package_id [ad_acs_kernel_id] -value 0
            aa_false "Param UseEmailForLoginP 0 -> false" [auth::UseEmailForLoginP]

            array set elms [auth::get_registration_elements]
            aa_false "Registration elements do contain username" {"username" ni [concat $elms(required) $elms(optional)]}

            parameter::set_value -parameter UseEmailForLoginP -package_id [ad_acs_kernel_id] -value {}
            aa_true "Param UseEmailForLoginP {} -> true" [auth::UseEmailForLoginP]

            # "foo" is an invalid value, it can't be true
            parameter::set_value -parameter UseEmailForLoginP -package_id [ad_acs_kernel_id] -value {foo}
            aa_false "Param UseEmailForLoginP foo -> false" [auth::UseEmailForLoginP]

            # Test login/registration

            parameter::set_value -parameter UseEmailForLoginP -package_id [ad_acs_kernel_id] -value 1
            aa_true "Param UseEmailForLoginP 1 -> true" [auth::UseEmailForLoginP]

            # GetElements
            array set elms [auth::get_registration_elements]
            aa_true "Registration elements do NOT contain username" {"username" ni [concat $elms(required) $elms(optional)]}

            set authority_id [auth::authority::get_id -short_name "acs_testing"]

            # Create a user with no username
            set email [string tolower "[ad_generate_random_string]@foobar.com"]
            set password [ad_generate_random_string]

            ad_try {
                array set result [auth::create_user  -authority_id $authority_id  -email $email  -password $password  -first_names [ad_generate_random_string]  -last_name [ad_generate_random_string]  -secret_question [ad_generate_random_string]  -secret_answer [ad_generate_random_string]  -screen_name [ad_generate_random_string]]
            } on ok {r} {
                aa_true "auth::create_user with no username succeeded" 1
            } on error {errorMsg} {
                aa_false  "auth::create_user with no username failed: '$errorMsg'" 1
                set result(creation_status) "NOT OK"
            }

            aa_equals "Registration OK" $result(creation_status) "ok"

            # Authenticate as that user
            array unset result
            array set result [auth::authenticate  -authority_id $authority_id  -email $email  -password $password  -no_cookie]

            aa_equals "Authentication OK" $result(auth_status) "ok"

        } -teardown_code {
            ad_parameter_cache -delete [ad_acs_kernel_id] UseEmailForLoginP
        }
}} {
          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_use_email_for_login_p (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: