twt::user::login (public)
twt::user::login email password [ username ]
Defined in packages/acs-automated-testing/tcl/tclwebtest-procs.tcl
tclwebtest for logging the user in.
- Parameters:
- email - Email of user to log in.
password - Password of user to log in.
username (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {$username eq ""} { set username $email } aa_log "twt::login email $email password $password username $username" tclwebtest::cookies clear # Request the start page ::twt::do_request [acs::test::url]/register # Login the user tclwebtest::form find ~n login set local_authority_id [auth::authority::local] set local_authority_pretty_name [auth::authority::get_element -authority_id $local_authority_id -element pretty_name] if {![catch {tclwebtest::field find ~n authority_id} errmsg]} { tclwebtest::field select $local_authority_pretty_name aa_log "twt::login selecting authority_id $local_authority_id" } if {[catch {tclwebtest::field find ~n email} errmsg]} { tclwebtest::field find ~n username tclwebtest::field fill $username aa_log "twt::login using username instead of email" } else { aa_log "twt::login using email instead of username" tclwebtest::field fill "$email" } tclwebtest::field find ~n password tclwebtest::field fill $password tclwebtest::form submit # Verify that user is actually logged in and throw error otherwise set home_uri "/pvt/home" twt::do_request $home_uri set response_url [tclwebtest::response url] if { ![string match "*${home_uri}*" $response_url] } { if { [party::get_by_email -email $email] eq "" } { error "Failed to login user with email=\"$email\" and password=\"$password\". No user with such email in database." } else { ns_log Error "Failed to log in user with email=\"$email\" and password=\"$password\" even though email exists (password may be incorrect). response_body=[tclwebtest::response body]" error "Failed to log in user with email=\"$email\" and password=\"$password\" even though email exists (password may be incorrect). User should be able to request $home_uri without redirection (response url=$response_url)" } }XQL Not present: Generic, PostgreSQL, Oracle