_acs-authentication__sync_snapshot (private)
_acs-authentication__sync_snapshot
Defined in packages/acs-authentication/tcl/test/sync-test-procs.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set _aa_export {} set body_count 1 foreach testcase_body {{ aa_run_with_teardown -rollback -test_code { # Start noninteractive job set test_authority_id [auth::authority::get_id -short_name "acs_testing"] set job_id [auth::sync::job::start -authority_id $test_authority_id] aa_true "Returns a job_id" {$job_id ne ""} ##### # # Valid insert action # ##### set username1 [ad_generate_random_string] set email1 "[ad_generate_random_string]@foo.bar" array unset user_info set user_info(email) $email1 set user_info(first_names) [ad_generate_random_string] set user_info(last_name) [ad_generate_random_string] set user_info(url) "http://[ad_generate_random_string].com" aa_log "--- Valid insert --- auth::sync::job::action -opration insert -username $username1 -email $email1" set entry_id [auth::sync::job::action -job_id $job_id -operation "snapshot" -username $username1 -array user_info] array unset entry auth::sync::job::get_entry -entry_id $entry_id -array entry aa_equals "entry.success_p" $entry(success_p) "t" aa_equals "entry.message" $entry(message) {} aa_equals "entry.element_messages" $entry(element_messages) {} aa_equals "entry.operation" $entry(operation) "insert" aa_log "entry.user_id = '$entry(user_id)'" aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" if { [aa_true "Entry has user_id set" {$entry(user_id) ne ""}] } { set user [acs_user::get -user_id $entry(user_id)] aa_equals "user.first_names" [dict get $user first_names] $user_info(first_names) aa_equals "user.last_name" [dict get $user last_name] $user_info(last_name) aa_equals "user.email" [dict get $user email] [string tolower $email1] aa_equals "user.authority_id" [dict get $user authority_id] $test_authority_id aa_equals "user.username" [dict get $user username] $username1 aa_equals "user.url" [dict get $user url] $user_info(url) } ##### # # Valid update action # ##### array unset user_info set user_info(email) "[ad_generate_random_string]@foo.bar" set user_info(first_names) [ad_generate_random_string] set user_info(last_name) [ad_generate_random_string] set user_info(url) "http://[ad_generate_random_string].com" aa_log "--- Valid update --- auth::sync::job::action -opration update -username $username1" set entry_id [auth::sync::job::action -job_id $job_id -operation "snapshot" -username $username1 -array user_info] array unset entry auth::sync::job::get_entry -entry_id $entry_id -array entry aa_equals "entry.success_p" $entry(success_p) "t" aa_equals "entry.message" $entry(message) {} aa_equals "entry.element_messages" $entry(element_messages) {} aa_equals "entry.operation" $entry(operation) "update" aa_log "entry.user_id = '$entry(user_id)'" aa_log "entry.message = '$entry(message)'" aa_log "entry.element_messages = '$entry(element_messages)'" if { [aa_true "Entry has user_id set" {$entry(user_id) ne ""}] } { set user [acs_user::get -user_id $entry(user_id)] aa_equals "user.first_names" [dict get $user first_names] $user_info(first_names) aa_equals "user.last_name" [dict get $user last_name] $user_info(last_name) aa_equals "user.email" [dict get $user email] [string tolower $user_info(email)] aa_equals "user.authority_id" [dict get $user authority_id] $test_authority_id aa_equals "user.username" [dict get $user username] $username1 aa_equals "user.url" [dict get $user url] $user_info(url) } ##### # # Wrap up batch sync job # ##### # We need this number to check the counts below set authority_id $test_authority_id set num_users_not_banned [db_string select_num { select count(*) from cc_users where authority_id = :authority_id and member_state != 'banned' }] auth::sync::job::snapshot_delete_remaining -job_id $job_id ##### # # End job # ##### array set job [auth::sync::job::end -job_id $job_id] aa_true "Elapsed time less than 30 seconds" {$job(run_time_seconds) < 30} aa_false "Not interactive" [string is true -strict $job(interactive_p)] aa_equals "Number of actions" $job(num_actions) [expr {$num_users_not_banned + 1}] aa_equals "Number of problems" $job(num_problems) 0 aa_false "Log URL nonempty" {$job(log_url) eq ""} } }} { 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" "sync_snapshot (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }XQL Not present: Generic, PostgreSQL, Oracle