Index: openacs-4/packages/forums/tcl/test/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/test/forums-procs.tcl,v diff -u -r1.1.4.2 -r1.1.4.3 --- openacs-4/packages/forums/tcl/test/forums-procs.tcl 20 Jul 2005 17:55:26 -0000 1.1.4.2 +++ openacs-4/packages/forums/tcl/test/forums-procs.tcl 14 Sep 2005 15:22:11 -0000 1.1.4.3 @@ -146,7 +146,7 @@ } -aa_register_case -cats {web smoke} forum_new_web { +aa_register_case -cats {web smoke} web_forum_new { Testing the creation of a forum via web } { @@ -156,36 +156,34 @@ # Login user array set user_info [twt::user::create -admin] twt::user::login $user_info(email) $user_info(password) - - # Create a new forum - set name [ad_generate_random_string] - forums::twt::new "$name" + # Create a new forum + set name [ad_generate_random_string] + set response [forums::twt::new "$name"] + aa_display_result -response $response -explanation {Webtest for the creation of a new Forum} } } -aa_register_case -cats {web smoke} forum_edit { +aa_register_case -cats {web smoke} web_forum_edit { Testing the edition of an existing forum } { - -aa_run_with_teardown -test_code { - - tclwebtest::cookies clear - # Login user - array set user_info [twt::user::create -admin] - twt::user::login $user_info(email) $user_info(password) - - # Create a forum - set name [ad_generate_random_string] - forums::twt::new "$name" - # Edit the created forum - forums::twt::edit "$name" - twt::user::logout + aa_run_with_teardown -test_code { + tclwebtest::cookies clear + # Login user + array set user_info [twt::user::create -admin] + twt::user::login $user_info(email) $user_info(password) + # Create a forum + set name [ad_generate_random_string] + forums::twt::new "$name" + # Edit the created forum + set response [forums::twt::edit "$name"] + aa_display_result -response $response -explanation {Webtest for the edition of a forum} + twt::user::logout + } } -} -aa_register_case -cats {web smoke} message_new { +aa_register_case -cats {web smoke} web_message_new { Posting a new message to an existing forum } { tclwebtest::cookies clear @@ -198,12 +196,12 @@ set subject [ad_generate_random_string] forums::twt::new "$name" # Post a message in the created forum - forums::twt::new_post "$name" "$subject" - - twt::user::logout + set response [forums::twt::new_post "$name" "$subject"] + aa_display_result -response $response -explanation {Webtest for posting a message in a forum} + twt::user::logout } -aa_register_case -cats {web smoke} message_edit { +aa_register_case -cats {web smoke} web_message_edit { Editing a message of a forum } { tclwebtest::cookies clear @@ -218,12 +216,13 @@ # Post a message in the created forum forums::twt::new_post "$name" "$subject" # Edit the posted message - forums::twt::edit_post "$name" "$subject" + set response [forums::twt::edit_post "$name" "$subject"] + aa_display_result -response $response -explanation {Webtest for editing the message of a forum} twt::user::logout } -aa_register_case -cats {web smoke} message_reply { +aa_register_case -cats {web smoke} web_message_reply { Post a reply a message in the forum } { tclwebtest::cookies clear @@ -238,12 +237,12 @@ # Post a message in the created forum forums::twt::new_post "$name" "$subject" # Edit the posted message - forums::twt::reply_msg "$name" "$subject" - + set response [forums::twt::reply_msg "$name" "$subject"] + aa_display_result -response $response -explanation {Webtest for posting a reply to a msg in the forum} twt::user::logout } -aa_register_case -cats {web smoke} message_delete { +aa_register_case -cats {web smoke} web_message_delete { Delete a message in the forum } { tclwebtest::cookies clear @@ -258,7 +257,7 @@ # Post a message in the created forum forums::twt::new_post "$name" "$subject" # Edit the posted message - forums::twt::delete_post "$name" "$subject" - + set response [forums::twt::delete_post "$name" "$subject"] + aa_display_result -response $response -explanation {Webtest for deleting a message posted in the forum} twt::user::logout } \ No newline at end of file Index: openacs-4/packages/forums/tcl/test/tclwebtest-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/test/Attic/tclwebtest-procs.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/forums/tcl/test/tclwebtest-procs.tcl 20 Jul 2005 17:12:40 -0000 1.1.2.1 +++ openacs-4/packages/forums/tcl/test/tclwebtest-procs.tcl 14 Sep 2005 15:22:11 -0000 1.1.2.2 @@ -1,28 +1,16 @@ ad_library { Automated tests. - @author Gerardo Morales (gmorales@gmorales.net) + @author Gerardo Morales (gerardo.morales@gmail.net) @creation-date 14 June 2005 } namespace eval forums::twt { - ad_proc get_one_url { } { - Get the url of the first instance founded int the site_node table - } { - db_1row first_formu_url { - select site_node__url(node_id) as url - from site_nodes - where object_id in (select package_id from apm_packages - where package_key = 'forums') - limit 1;} - return $url - } - ad_proc new { name } { - + set response 0 # The Faq Admin page url - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page # Seting the charter that would be used in the forum creation form set charter "[ad_generate_random_string] [ad_generate_random_string]" @@ -43,14 +31,16 @@ aa_error "The forum $name was not created. The forum name or the charter was not founded in the admin page of forums" } else { aa_log "The forum $name was succesfully created" + set response 1 } - +return $response } ad_proc edit { name } { + set response 0 # Call to the faq admin page - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page # Follows the link of administration and then admin the forum @@ -74,19 +64,21 @@ if { [catch {tclwebtest::link find "Edited $name"} testerror1] ||[catch {tclwebtest::assert text "$charter"} testerror2 ] } { aa_error "The forum $name was not Edited. The forum name or the charter was not founded in the admin page of forums" } else { - aa_log "The forum $name was succesfully edited, new name Edited $name" + aa_log "The forum $name was succesfully edited, new name Edited $name" + set response 1 } + return $response - } ad_proc new_post {name subject} { - + + set response 0 # Seting the Subject and Body of the new post set msgb "[ad_generate_random_string] [ad_generate_random_string 20]" # Call to the faq admin page - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page @@ -115,20 +107,21 @@ if { [catch {tclwebtest::assert text "$msgb"} testerror2 ] } { aa_error "The body of the message was not correctly posted" } else { - aa_log "The message was succesfully posted" + aa_log "The message was succesfully posted" + set response 1 } +return $response +} - } - ad_proc edit_post {name subject} { - + set response 0 # Seting the new body of the message set msgb2 "[ad_generate_random_string] [ad_generate_random_string 20]" # Call to the faq admin page - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page @@ -155,16 +148,17 @@ aa_error "The body of the message was not correctly edited" } else { aa_log "The message $subject of the forum $name was succesfully edited" + set response 1 } + return $response +} - } - ad_proc delete_post {name subject} { - + set response 0 # Call to the faq admin page - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page @@ -176,22 +170,25 @@ # Testing if the the message is not in the forum if {[catch {tclwebtest::link follow "Edited $subject"}]} { - aa_log "The messaje $subject was succesfully deleted in the forum $name" + aa_log "The messaje $subject was succesfully deleted in the forum $name" + set response 1 } else { - aa_error "The message $subject of the forum $name was not deleted" + aa_error "The message $subject of the forum $name was not deleted" } + return $response } ad_proc reply_msg {name subject} { + set response 0 # Seting the new body of the message set msgb_reply "[ad_generate_random_string] [ad_generate_random_string 20]" # Call to the faq admin page - set forum_admin_page [forums::twt::get_one_url] + set forum_admin_page [aa_get_first_url -package_key forums] ::twt::do_request $forum_admin_page @@ -216,8 +213,9 @@ aa_error "The body of the replyed message was not correctly posted" } else { aa_log "The reply message to $subject of the forum $name was succesfully posted" + set response 1 } - + return $response } } \ No newline at end of file