_news__db_check_news_set_approve (private)
_news__db_check_news_set_approve
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 # # Create a new revision of the news article. # set p_item_id $item_id set p_title "My title 2" set p_text "My text 2" set p_description "Description 2" set p_package_id $_news_package_id set p_full_details "t" set p_make_active_revision_p "t" aa_call_component db-news-revision-create set revision2_id $revision_id # # Unapprove revision2. # set p_revision_id $revision2_id set p_approve_p "f" aa_call_component db-news-set-approve # # Retrieve the cr_news column for revision 2 # set p_news_id $revision2_id aa_call_component db-get-cr-news-row if {!$retrieval_ok_p} { aa_error "cr_news row not found for new revision news_id $revision2_id" } else { aa_equals "Check the archive_date is null" $archive_date "" aa_equals "Check the approval_date is null" $approval_date "" aa_equals "Check the aprroval_user is null" $approval_user "" aa_equals "Check the approval_ip is null" $approval_ip "" } # # Retrieve the row from cr_revisions table to check publish date. # set p_revision_id $revision2_id aa_call_component db-get-cr-revisions-row if {!$retrieval_ok_p} { aa_error "cr_revisions row not found for new revision revision_id $revision2_id" } else { aa_equals "Check revision 2 publish_date is null" $publish_date "" } # # Approve revision 1 and set it as the live revision. # set p_revision_id $revision1_id set p_approve_p "t" set p_publish_date "2001-11-01" set p_archive_date "2001-11-02" 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 second revision is now live. # set p_item_id $item_id aa_call_component db-news-get-live-revision aa_equals "Confirm that revision 1 of the article is now live" $live_revision_id $revision1_id # # Retrieve the cr_news column for revision 1 # set p_news_id $revision1_id aa_call_component db-get-cr-news-row if {!$retrieval_ok_p} { aa_error "cr_news row not found for new revision news_id $revision1_id" } else { aa_equals "Check the archive_date is correct" [string range $archive_date 0 [string length $p_archive_date]-1] $p_archive_date aa_equals "Check the approval_date is correct" [string range $approval_date 0 [string length $p_approval_date]-1] $p_approval_date aa_equals "Check the aprroval_user is correct" [string range $approval_user 0 [string length $p_approval_user]-1] $p_approval_user aa_equals "Check the approval_ip is correct" [string range $approval_ip 0 [string length $p_approval_ip]-1] $p_approval_ip } # # Retrieve the row from cr_revisions table to check publish date. # set p_revision_id $revision1_id aa_call_component db-get-cr-revisions-row if {!$retrieval_ok_p} { aa_error "cr_revisions row not found for new revision revision_id $revision1_id" } else { aa_equals "Check revision 1 publish_date is null" [string range $publish_date 0 [string length $p_publish_date]-1] $p_publish_date } } } { # # 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_set_approve (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