_news__db_check_news_status (private)
_news__db_check_news_status
Defined in packages/news/tcl/test/news-db-test-init.tcl
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: upvar 2 _aa_exports _aa_exports foreach init_class mount-news-package { if {[llength $init_class] == 2} { lassign $init_class init_class init_package_key } else { set init_package_key news } foreach v $_aa_exports([list $init_package_key $init_class]) { upvar 2 $v $v } foreach logpair $::aa_init_class_logs([list $init_package_key $init_class]) { aa_log_result [lindex $logpair 0] [lindex $logpair 1] } } set _aa_export {} set body_count 1 foreach testcase_body {{ set news_id -1 if {!$_news_package_mounted_p} { aa_error "News package not mounted, error from initializer: $_news_package_mounted_err" } else { # # Create the article # set p_title "My title" set p_text "My text" set p_package_id $_news_package_id set p_is_live "t" set p_full_details "t" aa_call_component db-news-globals aa_call_component db-news-item-create } } { aa_true "Check the news_id is populated" {$news_id != -1} set item_id -1 set revision1_id -1 set revision2_id -1 if {$news_id != -1} { # # Retrieve the row from cr_revisions table to get item_id # set p_revision_id $news_id aa_call_component db-get-cr-revisions-row set revision1_id $news_id # # Unapprove revision 1 and set it as the live revision. # aa_log "Unapproving revision 1, setting publish_date null, archive_date null" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "" set p_archive_date "" set p_approval_user [ad_conn "user_id"] set p_approval_date "" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Unapproved status" $status unapproved # # Approve revision 1 and set it as the live revision. # aa_log "Approving revision 1, setting archive date as null" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date [clock format [clock scan "+ 1 year"] -format %Y-%m-%d] ; # in the future set p_archive_date "" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Going live no archive status" $status going_live_no_archive # # Approve revision 1 and set it as the live revision. # aa_log "Approving revision 1, setting archive date as future value" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date [clock format [clock scan "+ 1 year"] -format %Y-%m-%d] ; # in the future set p_archive_date "2005-11-10" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Going live scheduled for archive status" $status going_live_with_archive # # Approve revision 1 and set it as the live revision. # aa_log "Approving revision 1, setting publish date in past, archive date null" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "2000-11-01" set p_archive_date "" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Published no archive status" $status published_no_archive # # Approve revision 1 and set it as the live revision. # aa_log "Approving revision 1, setting publish date in past, archive date in past" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "2000-11-01" set p_archive_date "2000-11-01" set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Archived status" $status archived # # Approve revision 1 and set it as the live revision. # aa_log "Approving revision 1, setting publish date in past, archive date in future" set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "2000-11-01" set p_archive_date [clock format [clock scan "+ 1 year"] -format %Y-%m-%d] ; # in the future set p_approval_user [ad_conn "user_id"] set p_approval_date "2001-11-03" set p_approval_ip [ad_conn "peeraddr"] set p_live_revision_p "t" aa_call_component db-news-set-approve # # Check the status of revision 1. # set p_news_id $revision1_id aa_call_component db-news-status aa_equals "Published with archive" $status published_with_archive } } { # # Delete the item. # if {$item_id != -1} { aa_log "Deleting item." set p_item_id $item_id aa_call_component db-news-item-delete } }} { 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" "db_check_news_status (body $body_count): Error during execution: $msg, stack trace: \n$::errorInfo" } incr body_count }Generic XQL file: packages/news/tcl/test/news-db-test-init.xql
PostgreSQL XQL file: packages/news/tcl/test/news-db-test-init-postgresql.xql
Oracle XQL file: packages/news/tcl/test/news-db-test-init-oracle.xql