Index: openacs-4/packages/acs-content-repository/tcl/content-folder-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-folder-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-content-repository/tcl/content-folder-procs.tcl 1 Jul 2004 16:45:03 -0000 1.3 +++ openacs-4/packages/acs-content-repository/tcl/content-folder-procs.tcl 1 Jul 2004 17:15:55 -0000 1.4 @@ -88,9 +88,8 @@ } { return [package_exec_plsql \ -var_list [list \ - folder_id $folder_id \ - cascape_p $cascade_p - ] \ + [list folder_id $folder_id ] \ + [list cascade_p $cascade_p] ] \ content_folder delete ] } @@ -244,7 +243,7 @@ } { return [package_exec_plsql \ -var_list [list \ - folder_id $folder_id \ + [list folder_id $folder_id ] \ ] \ content_folder is_empty] } 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.1 -r1.2 --- openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 10 Jun 2004 01:14:26 -0000 1.1 +++ openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 1 Jul 2004 17:15:56 -0000 1.2 @@ -17,55 +17,63 @@ } { 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}"] - content::folder::register_content_type \ - -folder_id $first_folder_id \ - -content_type "content_revision" \ - - aa_true "Folder created" [expr $first_folder_id == $returned_first_folder_id] - # create another - set second_folder_id [db_nextval "acs_object_id_seq"] - set returned_second_folder_id [content::folder::new \ - -folder_id $second_folder_id \ - -name "test_folder_${second_folder_id}"] - aa_true "Folder 2 created" [expr $second_folder_id == $returned_second_folder_id] - # create a cr_item - 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 \ - -parent_id $first_folder_id] + -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}"] - aa_true "First item created" [expr $first_item_id == $returned_first_item_id] - # copy it + content::folder::register_content_type \ + -folder_id $first_folder_id \ + -content_type "content_revision" - # move the copy + aa_true "Folder created" [expr $first_folder_id == $returned_first_folder_id] - # delete the copy + set is_empty [content::folder::is_empty -folder_id $first_folder_id] + aa_true "Folder is empty" [string is true $is_empty] - # rename it + # create another + set second_folder_id [db_nextval "acs_object_id_seq"] + set returned_second_folder_id [content::folder::new \ + -folder_id $second_folder_id \ + -name "test_folder_${second_folder_id}"] + aa_true "Folder 2 created" [expr $second_folder_id == $returned_second_folder_id] + # create a cr_item + 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 \ + -parent_id $first_folder_id] - # publish it + aa_true "First item created" [expr $first_item_id == $returned_first_item_id] - # unpublish it + # check the folder is not empty now. + set is_empty [content::folder::is_empty -folder_id $first_folder_id] + aa_true "Folder 1 is not empty" [string is false $is_empty] - # delete first folder and everything in it to clean up - content::folder::delete \ - -folder_id $second_folder_id + # copy it - content::folder::delete \ - -folder_id $first_folder_id \ - -cascade_p "t" - - - } + # move the copy + # delete the copy + + # rename it + + # publish it + + # unpublish it + + # delete first folder and everything in it to clean up + content::folder::delete \ + -folder_id $second_folder_id + + content::folder::delete \ + -folder_id $first_folder_id \ + -cascade_p "t" + } + } 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.1 -r1.2 --- openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl 10 Jun 2004 01:14:26 -0000 1.1 +++ openacs-4/packages/acs-content-repository/tcl/test/content-revision-test-procs.tcl 1 Jul 2004 17:15:56 -0000 1.2 @@ -1,9 +1,6 @@ -# - ad_library { - Procedures to test content::revision tcl API - + @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-05 @arch-tag: e8817de4-54e8-48f6-99bc-49c0a8d94691 @@ -16,45 +13,50 @@ } { aa_run_with_teardown \ - -rollback \ - -test_code { + -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}"] - content::folder::register_content_type \ - -folder_id $first_folder_id \ - -content_type "content_revision" \ - - aa_true "Folder created" [expr $first_folder_id == $returned_first_folder_id] + # 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}"] + aa_true "Folder created" [expr $first_folder_id == $returned_first_folder_id] - # create a cr_item - 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 \ - -parent_id $first_folder_id] + content::folder::register_content_type \ + -folder_id $first_folder_id \ + -content_type "content_revision" \ - aa_true "First item created" [expr $first_item_id == $returned_first_item_id] - - # create a revision - set revision_id [db_nextval "acs_object_id_seq"] - - set returned_revision_id [content::revision::new \ - -revision_id $revision_id \ - -item_id $first_item_id \ - -title "Test Title" \ - -description "Test Description" \ - -content "Test Content"] - aa_true "Basic Revision created revision_id $revision_id returned_revision_id $returned_revision_id " [expr $revision_id == $returned_revision_id] + # create a cr_item + 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 \ + -parent_id $first_folder_id] - set r [db_string get_r {select revision_id from cr_revisions - where item_id=:first_item_id and title='Test Title' and - description='Test Description' and content='Test Content'} -default ""] - aa_true "Revision contains correct content" [expr $revision_id == $returned_revision_id] - content::item::delete -item_id $first_item_id - content::folder::delete -folder_id $first_folder_id - } + aa_true "First item created" [expr $first_item_id == $returned_first_item_id] + + # create a revision + set revision_id [db_nextval "acs_object_id_seq"] + + set returned_revision_id [content::revision::new \ + -revision_id $revision_id \ + -item_id $first_item_id \ + -title "Test Title" \ + -description "Test Description" \ + -content "Test Content"] + aa_true "Basic Revision created revision_id $revision_id returned_revision_id $returned_revision_id " [expr $revision_id == $returned_revision_id] + + set r [db_string get_r {select revision_id from cr_revisions + where item_id=:first_item_id and title='Test Title' and + description='Test Description' and content='Test Content'} -default ""] + aa_true "Revision contains correct content" [expr $revision_id == $returned_revision_id] + content::item::delete -item_id $first_item_id + + content::folder::unregister_content_type \ + -folder_id $first_folder_id \ + -content_type "content_revision" \ + + content::folder::delete -folder_id $first_folder_id + } }