Index: openacs-4/packages/acs-automated-testing/tcl/test/acs-automated-testing-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/test/acs-automated-testing-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-automated-testing/tcl/test/acs-automated-testing-procs.tcl 7 Aug 2017 23:47:46 -0000 1.4 +++ openacs-4/packages/acs-automated-testing/tcl/test/acs-automated-testing-procs.tcl 20 Jul 2018 08:41:29 -0000 1.5 @@ -6,7 +6,17 @@ @cvs-id $Id$ } -aa_register_case -cats {web smoke} -libraries tclwebtest tclwebtest_example { +aa_register_case \ + -cats {web} \ + -procs { + twt::user::create + twt::user::login + twt::do_request + twt::user::logout + twt::user::delete + } \ + -libraries tclwebtest \ + tclwebtest_example { A simple test case demonstrating the use of tclwebtest (HTTP level testing). @author Peter Marklund Index: openacs-4/packages/acs-automated-testing/tcl/test/selenium-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-automated-testing/tcl/test/selenium-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-automated-testing/tcl/test/selenium-procs.tcl 7 Aug 2017 23:47:46 -0000 1.2 +++ openacs-4/packages/acs-automated-testing/tcl/test/selenium-procs.tcl 20 Jul 2018 08:41:29 -0000 1.3 @@ -4,10 +4,12 @@ aa_register_case \ -cats {web selenium smoke} \ - -init_classes {{selenium acs-automated-testing}} selenium_server_configured { + -init_classes {{selenium acs-automated-testing}} \ + -procs {Se} \ + selenium_server_configured { Is the selenium server configured and working? } { - aa_false "Start Selenium RC Session" [catch {Se start} errmsg] + aa_false "Start Selenium RC Session" [catch {Se start} errmsg] aa_log $errmsg aa_false "Open [ad_url]" [catch {Se open [ad_url]} errmsg] aa_log $errmsg Index: openacs-4/packages/acs-content-repository/tcl/test/acs-content-repository-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/acs-content-repository-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/tcl/test/acs-content-repository-procs.tcl 19 Jul 2018 12:16:20 -0000 1.7 +++ openacs-4/packages/acs-content-repository/tcl/test/acs-content-repository-procs.tcl 20 Jul 2018 08:41:29 -0000 1.8 @@ -6,7 +6,15 @@ @cvs-id $Id$ } -aa_register_case -cats {smoke api} acs_content_repository_trivial_smoke_test { +aa_register_case \ + -cats {smoke api db} \ + -procs { + ad_generate_random_string + content::keyword::delete + content::keyword::get_children + content::keyword::new + } + acs_content_repository_trivial_smoke_test { Minimal smoke test. } { Index: openacs-4/packages/acs-content-repository/tcl/test/content-folder-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-folder-test-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/tcl/test/content-folder-test-procs.tcl 19 Jul 2018 12:16:20 -0000 1.5 +++ openacs-4/packages/acs-content-repository/tcl/test/content-folder-test-procs.tcl 20 Jul 2018 08:41:29 -0000 1.6 @@ -1,73 +1,79 @@ -# - ad_library { Tests for content folders @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2005-01-13 - @arch-tag: ce944027-3808-4e8d-9327-5d1377074643 @cvs-id $Id$ } -aa_register_case content_folder { - content folder test -} { +aa_register_case \ + -cats {api db} \ + -procs { + content::folder::is_sub_folder + content::folder::new + content::folder::register_content_type + content::folder::update + content::item::get + } \ + content_folder { + content folder test + } { - aa_run_with_teardown \ - -rollback \ - -test_code { + aa_run_with_teardown \ + -rollback \ + -test_code { - ######################################################### - # create a cr_folder - ######################################################### - set first_folder_id [db_nextval "acs_object_id_seq"] - set returned_first_folder_id [content::folder::new \ - -folder_id $first_folder_id \ - -name "test_folder_${first_folder_id}"] - # allow subfolders inside our parent test folder - content::folder::register_content_type \ - -folder_id $first_folder_id \ - -content_type content_folder - + ######################################################### + # create a cr_folder + ######################################################### + set first_folder_id [db_nextval "acs_object_id_seq"] + set returned_first_folder_id [content::folder::new \ + -folder_id $first_folder_id \ + -name "test_folder_${first_folder_id}"] + # allow subfolders inside our parent test folder + content::folder::register_content_type \ + -folder_id $first_folder_id \ + -content_type content_folder + - ######################################################### - # Update the folder - ######################################################### - content::folder::update \ - -folder_id $first_folder_id \ - -attributes {{label new_label} {description new_description}} - content::item::get \ - -item_id $first_folder_id \ - -array_name first_folder - aa_true "Folder updated" {($first_folder(label) eq "new_label") && ($first_folder(description) eq "new_description")} - - ######################################################### - # create a child folder - ######################################################### - set child_folder_id [db_nextval "acs_object_id_seq"] - set returned_child_folder_id [content::folder::new \ - -folder_id $child_folder_id \ - -parent_id $first_folder_id \ - -name "test_folder_${first_folder_id}"] - ######################################################### - # check if child is a subfolder of parent - ######################################################### - set is_subfolder [content::folder::is_sub_folder \ - -folder_id $first_folder_id \ - -target_folder_id $child_folder_id] - aa_true "Child is subfolder" [string equal "t" $is_subfolder] - - ######################################################### - # make sure parent is not a subfolder of child - ######################################################### - set is_subfolder [content::folder::is_sub_folder \ - -folder_id $child_folder_id \ - -target_folder_id $first_folder_id] - aa_true "Parent is not subfolder of child" [string equal "f" $is_subfolder] - - } -} + ######################################################### + # Update the folder + ######################################################### + content::folder::update \ + -folder_id $first_folder_id \ + -attributes {{label new_label} {description new_description}} + content::item::get \ + -item_id $first_folder_id \ + -array_name first_folder + aa_true "Folder updated" {($first_folder(label) eq "new_label") && ($first_folder(description) eq "new_description")} + + ######################################################### + # create a child folder + ######################################################### + set child_folder_id [db_nextval "acs_object_id_seq"] + set returned_child_folder_id [content::folder::new \ + -folder_id $child_folder_id \ + -parent_id $first_folder_id \ + -name "test_folder_${first_folder_id}"] + ######################################################### + # check if child is a subfolder of parent + ######################################################### + set is_subfolder [content::folder::is_sub_folder \ + -folder_id $first_folder_id \ + -target_folder_id $child_folder_id] + aa_true "Child is subfolder" $is_subfolder + + ######################################################### + # make sure parent is not a subfolder of child + ######################################################### + set is_subfolder [content::folder::is_sub_folder \ + -folder_id $child_folder_id \ + -target_folder_id $first_folder_id] + aa_false "Parent is not subfolder of child" $is_subfolder + + } + } # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-content-repository/tcl/test/content-image-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-image-test-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/tcl/test/content-image-test-procs.tcl 19 Jul 2018 12:16:20 -0000 1.7 +++ openacs-4/packages/acs-content-repository/tcl/test/content-image-test-procs.tcl 20 Jul 2018 08:41:29 -0000 1.8 @@ -7,7 +7,19 @@ } -aa_register_case content_image { +aa_register_case \ + -cats {api db} \ + -procs { + content::folder::delete + content::folder::new + content::folder::register_content_type + content::folder::unregister_content_type + content::item::delete + content::item::get_content + content::item::new + content::revision::new + } \ + content_image { content image test } { @@ -26,7 +38,7 @@ -content_type "image" \ # create a cr_item - set first_item_id [db_nextval "acs_object_id_seq"] + set first_item_id [db_nextval "acs_object_id_seq"] set returned_first_item_id [content::item::new \ -name "test_item_one" \ -item_id $first_item_id \ @@ -63,7 +75,15 @@ } } -aa_register_case -cats {api smoke db} image_new { +aa_register_case \ + -cats {api db} \ + -procs { + content::folder::new + content::folder::register_content_type + content::item::get_id + image::new + } + image_new { } { aa_run_with_teardown -rollback -test_code { Index: openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 19 Jul 2018 12:16:20 -0000 1.12 +++ openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 20 Jul 2018 08:41:29 -0000 1.13 @@ -7,10 +7,28 @@ @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-05-28 @cvs-id $Id$ - } -aa_register_case content_item { +aa_register_case \ + -cats {api db} \ + -procs { + ad_generate_random_string + content::folder::delete + content::folder::is_empty + content::folder::new + content::folder::register_content_type + content::item::delete + content::item::get + content::item::get_id + content::item::get_latest_revision + content::item::new + content::item::rename + content::item::update + content::type::attribute::new + content::type::delete + content::type::new + } \ + content_item { content item test } { @@ -65,12 +83,10 @@ aa_true "first item exists" {[content::item::get -item_id $first_item_id] == 1} aa_true "First item's revision exists" \ - [expr \ - {![string equal "" \ - [db_string get_revision { - select latest_revision from cr_items, cr_revisions - where latest_revision=revision_id and cr_items.item_id = :first_item_id - } -default ""]]}] + {[db_string get_revision { + select latest_revision from cr_items, cr_revisions + where latest_revision=revision_id and cr_items.item_id = :first_item_id + } -default ""] ne ""} # check the folder is not empty now. set is_empty [content::folder::is_empty -folder_id $first_folder_id] @@ -93,14 +109,12 @@ aa_true "Evil_name item created" {$evil_item_id == $returned_evil_item_id} - aa_true "Evil_name item exists" [expr \ - [content::item::get \ - -item_id $evil_item_id \ - -revision latest \ - -array_name evil_name] == 1] + aa_true "Evil_name item exists" {[content::item::get \ + -item_id $evil_item_id \ + -revision latest \ + -array_name evil_name] == 1} aa_true "Evil_name item's revision exists" \ - [expr \ - {$evil_name(latest_revision) ne ""}] + {$evil_name(latest_revision) ne ""} ######################################################### # delete the evil_name item @@ -112,13 +126,12 @@ content::item::delete -item_id $evil_item_id array unset evil_name - aa_true "evil_name item no longer exists" [expr \ + aa_true "evil_name item no longer exists" { [content::item::get \ -item_id $evil_item_id \ -revision "latest" \ - -array_name evil_name] == 0] - aa_true "evil_name item revision does not exist" [expr \ - ![info exists evil(latest_revision)]] + -array_name evil_name] == 0} + aa_true "evil_name item revision does not exist" {![info exists evil(latest_revision)]} ######################################################### @@ -179,8 +192,7 @@ ######################################################### # check that extended attribute exists ######################################################### - aa_true "Extended attribute set" [expr [string equal "attribute_value" \ - $new_type_item(attribute_name)]] + aa_equals "Extended attribute set" "attribute_value" $new_type_item(attribute_name) ######################################################### # test update of item and attributes @@ -193,7 +205,8 @@ -item_id $new_type_item_id \ -revision "latest" \ -array_name new_type_item - aa_true "Item updated $new_type_item(name) $new_type_item(publish_status)" {($new_type_item(name)) eq "new_name" && ($new_type_item(publish_status) eq "live")} + aa_true "Item updated $new_type_item(name) $new_type_item(publish_status)" \ + {$new_type_item(name) eq "new_name" && $new_type_item(publish_status) eq "live"} ######################################################### # copy it Index: openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl 19 Jul 2018 12:16:20 -0000 1.4 +++ openacs-4/packages/acs-content-repository/tcl/test/content-keyword-test-procs.tcl 20 Jul 2018 08:41:29 -0000 1.5 @@ -10,33 +10,41 @@ @cvs-id $Id$ } -aa_register_case content_keyword { - content_keyword test -} { - aa_run_with_teardown \ - -rollback \ - -test_code { +aa_register_case \ + -cats {api db} \ + -procs { + content::keyword::delete + content::keyword::get_description + content::keyword::get_heading + content::keyword::new + } \ + content_keyword { + content_keyword test + } { + aa_run_with_teardown \ + -rollback \ + -test_code { - # create a keyword - set assigned_keyword_id [db_nextval "acs_object_id_seq"] - set keyword_id [content::keyword::new \ - -heading "--test_keyword" \ - -description "--test_description" \ - -keyword_id $assigned_keyword_id] - # check that keyword_id, heading, description - # are set correctly - aa_true "Keyword_id assigned" \ - {$assigned_keyword_id == $keyword_id} - aa_true "Keyword heading set" \ - [string equal "--test_keyword" [content::keyword::get_heading -keyword_id $keyword_id]] - aa_true "Keyword description set" \ - [string equal "--test_description" [content::keyword::get_description -keyword_id $keyword_id]] - # delete it - content::keyword::delete -keyword_id $keyword_id - aa_true "Keyword deleted" \ - [string equal [db_string confirm_delete "" -default ""] ""] - } -} + # create a keyword + set assigned_keyword_id [db_nextval "acs_object_id_seq"] + set keyword_id [content::keyword::new \ + -heading "--test_keyword" \ + -description "--test_description" \ + -keyword_id $assigned_keyword_id] + # check that keyword_id, heading, description + # are set correctly + aa_true "Keyword_id assigned" \ + {$assigned_keyword_id == $keyword_id} + aa_equals "Keyword heading set" \ + [content::keyword::get_heading -keyword_id $keyword_id] "--test_keyword" + aa_equals "Keyword description set" \ + [content::keyword::get_description -keyword_id $keyword_id] "--test_description" + # delete it + content::keyword::delete -keyword_id $keyword_id + aa_equals "Keyword deleted" [db_string confirm_delete "" -default ""] "" + } + } + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl 19 Jul 2018 12:16:20 -0000 1.7 +++ openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl 20 Jul 2018 08:41:29 -0000 1.8 @@ -8,9 +8,22 @@ } -aa_register_case content_revision { - content revision test -} { +aa_register_case \ + -cats {api db} \ + -procs { + content::folder::delete + content::folder::new + content::folder::register_content_type + content::folder::unregister_content_type + content::item::delete + content::item::get_content + content::item::new + content::revision::new + cr_write_content + } \ + content_revision { + content revision test + } { aa_run_with_teardown -rollback -test_code { @@ -51,10 +64,11 @@ content::item::get_content -revision_id $returned_revision_id -array revision_content set revision_content(content) [cr_write_content -revision_id $returned_revision_id -string] - aa_true "Revision contains correct content" \ - { $revision_content(title) eq "Test Title" - && $revision_content(content) eq "Test Content" - && $revision_id == $revision_content(revision_id)} + aa_true "Revision contains correct content" { + $revision_content(title) eq "Test Title" + && $revision_content(content) eq "Test Content" + && $revision_id == $revision_content(revision_id) + } content::item::delete -item_id $first_item_id Index: openacs-4/packages/acs-content-repository/tcl/test/content-search-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-search-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-content-repository/tcl/test/content-search-procs.tcl 19 Jul 2018 12:16:20 -0000 1.5 +++ openacs-4/packages/acs-content-repository/tcl/test/content-search-procs.tcl 20 Jul 2018 08:41:29 -0000 1.6 @@ -12,12 +12,12 @@ Check if revision_id is in the search observer queue } { aa_false "Revision ${revision_id} is not queued for search events $events" \ - [expr [db_string check_queue [subst { + [db_string check_queue [subst { select count(*) from search_observer_queue where object_id = :revision_id and event in ([template::util::tcl_to_sql_list $events]) - }] -default 0]] + }] -default 0] } ad_proc -private cr_item_search::assert_in_queue { @@ -30,12 +30,12 @@ @param events List of events to check for (INSERT,UPDATE,DELETE) } { aa_true "Revision ${revision_id} is queued for search events $events" \ - [expr [db_string check_queue [subst { + [db_string check_queue [subst { select count(*) from search_observer_queue where object_id = :revision_id and event in ([template::util::tcl_to_sql_list $events]) - }] -default 0]] + }] -default 0] } ad_proc -private cr_item_search::remove_from_queue { @@ -58,8 +58,23 @@ } -aa_register_case -cats db cr_item_search_triggers { - Test search update trigger +aa_register_case \ + -cats {api db} \ + -procs { + content::item::get_id + content::item::get_latest_revision + content::item::get_live_revision + content::item::new + content::item::set_live_revision + content::item::unset_live_revision + content::item::update + cr_item_search::assert_in_queue + cr_item_search::assert_not_in_queue + cr_item_search::remove_from_queue + cr_item_search::test_setup + } \ + cr_item_search_triggers { + Test search update trigger } { if {![string match -nocase "oracle*" [db_name]]} { aa_run_with_teardown \ @@ -81,30 +96,31 @@ -root_folder_id $folder_id] \ ne ""} aa_true "Item is NOT live" {[content::item::get_live_revision \ - -item_id $item_id] eq ""} - aa_true "But a revision exists" \ - [expr \ - {[set latest_revision \ - [content::item::get_latest_revision \ - -item_id $item_id]] ne ""}] + -item_id $item_id] eq ""} + set latest_revision [content::item::get_latest_revision \ + -item_id $item_id] + aa_true "But a revision exists" {$latest_revision ne ""} aa_false "Item is NOT queued for search indexing" \ - [expr [db_string check_queue { + [db_string check_queue { select 1 from search_observer_queue where object_id = :latest_revision - } -default 0]] + } -default 0] + aa_log "Update Item, still no live revision" content::item::update \ -item_id $item_id \ -attributes [list [list name $item_name]] cr_item_search::assert_not_in_queue \ -revision_id $latest_revision \ -events [list INSERT UPDATE] + aa_log "Set live revision no publish date" content::item::set_live_revision \ -revision_id $latest_revision cr_item_search::assert_in_queue \ -revision_id $latest_revision \ -events [list INSERT UPDATE] + content::item::unset_live_revision -item_id $item_id cr_item_search::assert_in_queue \ -revision_id $latest_revision \ @@ -113,6 +129,7 @@ -revision_id $latest_revision set next_date [clock format [clock scan "tomorrow"] -format "%Y-%m-%d"] db_dml set_publish_date "update cr_revisions set publish_date=:next_date where revision_id=:latest_revision" + aa_log "Publish Date in future, live revision not set" cr_item_search::assert_not_in_queue \ -revision_id $latest_revision \ @@ -124,11 +141,11 @@ db_dml set_live_revision \ "update cr_items set live_revision=latest_revision where item_id=:item_id" + aa_log "Publish date in future, live revision set" cr_item_search::assert_not_in_queue \ -revision_id $latest_revision \ -events [list INSERT UPDATE] - } } }