Index: openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl 19 Jul 2018 13:36:36 -0000 1.9 +++ openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl 25 Jul 2018 13:42:48 -0000 1.10 @@ -6,12 +6,16 @@ @creation-date 11 August 2006 } -aa_register_case -cats {api smoke} -procs { - apm_parameter_register -} test_apm_parameter__register { - Test the apm_parameter_register procedure +aa_register_case \ + -cats {api smoke} \ + -procs { + apm_parameter_register + } \ + test_apm_parameter__register { + + Test the apm_parameter_register procedure - @author Veronica De La Cruz (veronica@viaro.net) + @author Veronica De La Cruz (veronica@viaro.net) } { aa_run_with_teardown -rollback -test_code { @@ -46,10 +50,13 @@ } } -aa_register_case -cats {api smoke} -procs {apm_package_instance_new} test_apm_package_instance__new { - Test the apm_package_instance_new procedure - @author Veronica De La Cruz (veronica@viaro.net) - +aa_register_case \ + -cats {api smoke} \ + -procs {apm_package_instance_new} \ + test_apm_package_instance__new { + + Test the apm_package_instance_new procedure + @author Veronica De La Cruz (veronica@viaro.net) } { aa_run_with_teardown -rollback -test_code { Index: openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl 19 Jul 2018 11:43:19 -0000 1.12 +++ openacs-4/packages/acs-tcl/tcl/test/ad-proc-test-procs.tcl 25 Jul 2018 13:42:48 -0000 1.13 @@ -6,7 +6,10 @@ @creation-date 2005-03-11 } -aa_register_case -cats {api smoke} ad_proc_create_callback { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_proc callback} \ + ad_proc_create_callback { Tests the creation of a callback and an implementation with some forced error cases. @@ -91,13 +94,16 @@ error "should fail" } -ad_proc EvilCallback {} { +ad_proc -private EvilCallback {} { This is a test callback implementation that should not be invoked. } { error "Should not be invoked" } -aa_register_case -cats {api smoke} ad_proc_fire_callback { +aa_register_case \ + -cats {api smoke} \ + -procs {callback} \ + ad_proc_fire_callback { Tests a callback with two implementations . @@ -120,10 +126,10 @@ {[callback -impl an_impl2 a_callback -arg1 foo bar] == 2} aa_true "callback works with {} args" \ - [expr {[callback -impl an_impl2 a_callback -arg1 {} {}] == {}}] + {[callback -impl an_impl2 a_callback -arg1 {} {}] == {}} aa_true "callback errors with missing arg" \ - [expr {[catch {callback -impl an_impl2 a_callback -arg1 foo} err] == 1}] + {[catch {callback -impl an_impl2 a_callback -arg1 foo} err] == 1} aa_true "throws error for invalid arguments with implementations" \ [catch {callback a_callback bar} error] Index: openacs-4/packages/acs-tcl/tcl/test/apm-parameter-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/apm-parameter-test-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/test/apm-parameter-test-procs.tcl 7 Aug 2017 23:48:00 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/test/apm-parameter-test-procs.tcl 25 Jul 2018 13:42:48 -0000 1.5 @@ -4,7 +4,16 @@ @creation-date 2006-08-10 } -aa_register_case -cats {api smoke} parameter_register_test { +aa_register_case \ + -cats {api smoke} \ + -procs { + apm_package_id_from_key + apm_parameter_register + apm_parameter_unregister + parameter::get + parameter::get_global_value + } \ + parameter_register_test { Test the registration of a parameter } { set parameter_id [db_nextval "acs_object_id_seq"] @@ -30,6 +39,94 @@ apm_parameter_unregister $parameter_id } +aa_register_case \ + -cats {api smoke} \ + -procs { + ad_parameter_cache + apm_package_id_from_key + apm_parameter_register + apm_parameter_unregister + parameter::get + parameter::get_from_package_key + parameter::get_global_value + parameter::set_default + parameter::set_from_package_key + parameter::set_global_value + parameter::set_value + } \ + parameter__check_procs { + Test the parameter::* procs + + @author Rocael Hernandez (roc@viaro.net) +} { + + aa_run_with_teardown -rollback -test_code { + + aa_log "Test global parameter functionality" + set parameter_id [db_nextval "acs_object_id_seq"] + apm_parameter_register -parameter_id $parameter_id -scope global x_test_x "" acs-tcl 0 number + parameter::set_global_value -package_key acs-tcl -parameter x_test_x -value 3 + aa_equals "check global parameter value set/get" \ + [parameter::get_global_value -package_key acs-tcl -parameter x_test_x] \ + 3 + apm_parameter_unregister $parameter_id + + foreach tuple [db_list_of_lists get_param { + select ap.parameter_name, ap.package_key, ap.default_value, ap.parameter_id + from apm_parameters ap, apm_package_types apt + where + ap.package_key = apt.package_key + and apt.singleton_p ='t' + and ap.package_key <> 'acs-kernel' and ap.package_key <> 'search' + }] { + + lassign $tuple parameter_name package_key default_value parameter_id + set value [random] + if {$parameter_name ne "PasswordExpirationDays" && $value > 0.7} { + + set package_id [apm_package_id_from_key $package_key] + set actual_value [db_string real_value { + select apm_parameter_values.attr_value + from apm_parameter_values + where apm_parameter_values.package_id = :package_id + and apm_parameter_values.parameter_id = :parameter_id + }] + + aa_log "$package_key $parameter_name $actual_value" + aa_equals "check parameter::get" \ + [parameter::get -package_id $package_id -parameter $parameter_name] \ + $actual_value + aa_equals "check parameter::get_from_package_key" \ + [parameter::get_from_package_key -package_key $package_key -parameter $parameter_name] \ + $actual_value + + parameter::set_default -package_key $package_key -parameter $parameter_name -value $value + set value_db [db_string get_values { + select default_value from apm_parameters + where package_key = :package_key and parameter_name = :parameter_name + }] + aa_equals "check parameter::set_default" $value $value_db + set value [expr {$value + 10}] + + parameter::set_from_package_key -package_key $package_key -parameter $parameter_name -value $value + aa_equals "check parameter::set_from_package_key" \ + [parameter::get -package_id $package_id -parameter $parameter_name] \ + $value + + set value [expr {$value + 10}] + parameter::set_value -package_id $package_id -parameter $parameter_name -value $value + aa_equals "check parameter::set_value" \ + [parameter::get -package_id $package_id -parameter $parameter_name] \ + $value + + ad_parameter_cache -delete $package_id $parameter_name + + break + } + } + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-tcl/tcl/test/application-data-link-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/application-data-link-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/test/application-data-link-procs.tcl 19 Jul 2018 11:43:19 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/test/application-data-link-procs.tcl 25 Jul 2018 13:42:48 -0000 1.8 @@ -2,93 +2,103 @@ Tests for application data links. } -aa_register_case -cats api data_links_scan_links { - Test scanning content for object URLs +aa_register_case \ + -cats api \ + -procs {} \ + data_links_scan_links { + Test scanning content for object URLs } { # get a new object_id from the sequence, this object will not exist set nonexistent_object_id [db_nextval "acs_object_id_seq"] set text {Some random text Some More Random Text /o/10 /file/11 /image/12 - /o/[junk] /file/[junk] /image/[junk] + /o/[junk] /file/[junk] /image/[junk] /o/" /file/" /image/" /o/[ /file/[ /image/[ - - } + + } ;#"] append text " " aa_log "ad_url = '[ad_url]'" set links [application_data_link::scan_for_links -text $text] set correct_links [list 0] aa_log "Links = '${links}'" - aa_true "Number of links found is correct" \ - {[llength $correct_links] eq [llength $links]} - + aa_true "Number of links found is correct" {[llength $correct_links] eq [llength $links]} } -aa_register_case -cats api data_links_update_links { - Test updating references, - tests scan_for_links - and delete_links in the process +aa_register_case \ + -cats api \ + -procs { + application_data_link::scan_for_links + application_data_link::update_links_from + application_data_link::get_links_from + content::item::new + } \ + data_links_update_links { + + Test updating references, tests scan_for_links and delete_links in + the process. + } { - aa_run_with_teardown \ - -rollback \ - -test_code \ - { - # create some test objects - set name [ns_mktemp "cr_item__XXXXXX"] - - for {set i 0} {$i<10} {incr i} { - set o($i) [content::item::new \ - -name ${name}_$i \ - -title ${name}_$i] - } - - # generate some text with links between the objects - foreach n [array names o] { - append text "\nTest Content Link to $o($n) Link \n" - } - # update the links - foreach n [array names o] { - application_data_link::update_links_from \ - -object_id $o($n) \ - -text $text - } - # scan for links and compare - set correct_links [lsort \ - [application_data_link::scan_for_links \ - -text $text]] - aa_true "Correct links is not empty" [llength $correct_links] - foreach n [array names o] { - set links [lsort \ - [application_data_link::get_links_from \ - -object_id $o($n)]] - aa_true "Object \#${n} references correct" \ - {$correct_links eq $links} - } - # now change the text and update one of the objects - for {set i 0} {$i < 5} {incr i} { - append new_text "\nTest Content Link to $o($i) /o/$o($i) \n" - } - for {set i 0} {$i < 5} {incr i} { - application_data_link::update_links_from \ - -object_id $o($i) \ - -text $new_text - } - set new_correct_links [lsort \ - [application_data_link::scan_for_links \ - -text $new_text]] + aa_run_with_teardown -rollback -test_code { + # create some test objects + set name [ns_mktemp "cr_item__XXXXXX"] - for {set i 0} {$i < 5} {incr i} { - set links [lsort \ - [application_data_link::get_links_from \ - -object_id $o($i)]] - aa_true "Object \#${i} updated references correct" \ - {$new_correct_links eq $links} - } - } + for {set i 0} {$i<10} {incr i} { + set o($i) [content::item::new \ + -name ${name}_$i \ + -title ${name}_$i] + } + + # generate some text with links between the objects + foreach n [array names o] { + append text "\nTest Content Link to $o($n) Link \n" + } + # update the links + foreach n [array names o] { + application_data_link::update_links_from \ + -object_id $o($n) \ + -text $text + } + # scan for links and compare + set correct_links [lsort [application_data_link::scan_for_links \ + -text $text]] + aa_true "Correct links is not empty" [llength $correct_links] + foreach n [array names o] { + set links [lsort [application_data_link::get_links_from \ + -object_id $o($n)]] + aa_true "Object \#${n} references correct" \ + {$correct_links eq $links} + } + # now change the text and update one of the objects + for {set i 0} {$i < 5} {incr i} { + append new_text "\nTest Content Link to $o($i) /o/$o($i) \n" + } + for {set i 0} {$i < 5} {incr i} { + application_data_link::update_links_from \ + -object_id $o($i) \ + -text $new_text + } + set new_correct_links [lsort [application_data_link::scan_for_links \ + -text $new_text]] + + for {set i 0} {$i < 5} {incr i} { + set links [lsort [application_data_link::get_links_from \ + -object_id $o($i)]] + aa_true "Object \#${i} updated references correct" \ + {$new_correct_links eq $links} + } + } } -aa_register_case -cats api data_links_scan_links_with_tag { - Test scanning content for object URLs with relation tag +aa_register_case \ + -cats api \ + -procs { + application_data_link::scan_for_links + } \ + data_links_scan_links_with_tag { + + Test scanning content for object URLs with relation tag. + } { # get a new object_id from the sequence, this object will not exist set nonexistent_object_id [db_nextval "acs_object_id_seq"] @@ -97,8 +107,8 @@ /o/[junk] /file/[junk] /image/[junk] /o/" /file/" /image/" /o/[ /file/[ /image/[ - - } + + } ;#"] append text " " aa_log "ad_url = '[ad_url]'" set links [application_data_link::scan_for_links -text $text] @@ -109,25 +119,30 @@ } -aa_register_case -cats api data_links_update_links_with_tag { - Test updating references, - tests scan_for_links - and delete_links in the process. - Uses relation tags +aa_register_case \ + -cats api \ + -procs { + application_data_link::get_links_from + application_data_link::scan_for_links + application_data_link::update_links_from + content::item::new + } \ + data_links_update_links_with_tag { + + Test updating references, tests scan_for_links and + delete_links in the process. Uses relation tags. + } { - aa_run_with_teardown \ - -rollback \ - -test_code \ - { + aa_run_with_teardown -rollback -test_code { # create some test objects set name [ns_mktemp "cr_item__XXXXXX"] - + for {set i 0} {$i<10} {incr i} { set o($i) [content::item::new \ -name ${name}_$i \ -title ${name}_$i] } - + # generate some text with links between the objects foreach n [array names o] { append text "\nTest Content Link to $o($n) Link \n" @@ -177,16 +192,28 @@ } -aa_register_case -cats api data_links_with_tag { - Test creating new link, exists test, get, get_linked and delete. Uses relation tags. +aa_register_case \ + -cats api \ + -procs { + acs_object_type + application_data_link::delete_links + application_data_link::get + application_data_link::get_linked + application_data_link::get_linked_content + application_data_link::link_exists + application_data_link::new + content::item::new + } \ + data_links_with_tag { + + Test creating new link, exists test, get, get_linked and + delete. Uses relation tags. + } { - aa_run_with_teardown \ - -rollback \ - -test_code \ - { + aa_run_with_teardown -rollback -test_code { # create some test objects set name [ns_mktemp "cr_item__XXXXXX"] - + for {set i 0} {$i<6} {incr i} { set o($i) [content::item::new \ -name ${name}_$i \ @@ -195,49 +222,50 @@ aa_log "Creating link between objects" application_data_link::new -this_object_id $o(0) -target_object_id $o(1) -relation_tag tag - + aa_true "Verify objects are linked" \ - [application_data_link::link_exists \ - -from_object_id $o(0) \ - -to_object_id $o(1) \ - -relation_tag tag] - + [application_data_link::link_exists \ + -from_object_id $o(0) \ + -to_object_id $o(1) \ + -relation_tag tag] + aa_log "Deleting links attached to first object" application_data_link::delete_links -object_id $o(0) - + aa_false "Verify objects are deleted" \ - [application_data_link::link_exists \ - -from_object_id $o(0) \ - -to_object_id $o(1) \ - -relation_tag tag] - + [application_data_link::link_exists \ + -from_object_id $o(0) \ + -to_object_id $o(1) \ + -relation_tag tag] + aa_log "Creating many links between objects" application_data_link::new -this_object_id $o(0) -target_object_id $o(1) -relation_tag tag1 application_data_link::new -this_object_id $o(0) -target_object_id $o(2) -relation_tag tag1 application_data_link::new -this_object_id $o(0) -target_object_id $o(3) -relation_tag tag2 application_data_link::new -this_object_id $o(3) -target_object_id $o(4) -relation_tag tag2 application_data_link::new -this_object_id $o(3) -target_object_id $o(5) -relation_tag tag2 - + aa_true "Verify link for tag1" \ - {[llength [application_data_link::get_linked -from_object_id $o(0) \ - -to_object_type [acs_object_type $o(0)] -relation_tag tag1]] == 2} + {[llength [application_data_link::get_linked -from_object_id $o(0) \ + -to_object_type [acs_object_type $o(0)] -relation_tag tag1]] == 2} aa_true "Verify link for tag2" \ - {[llength [application_data_link::get_linked -from_object_id $o(3) \ - -to_object_type [acs_object_type $o(3)] -relation_tag tag2]] == 3} + {[llength [application_data_link::get_linked -from_object_id $o(3) \ + -to_object_type [acs_object_type $o(3)] -relation_tag tag2]] == 3} aa_true "Verify content link" \ - {[llength [application_data_link::get_linked_content -from_object_id $o(0) \ - -to_content_type content_revision -relation_tag tag1]] == 2} - + {[llength [application_data_link::get_linked_content -from_object_id $o(0) \ + -to_content_type content_revision -relation_tag tag1]] == 2} + aa_true "Verify links to one object with multiple link tags" \ - {[llength [application_data_link::get -object_id $o(0) -relation_tag tag1]] == 2} - + {[llength [application_data_link::get -object_id $o(0) -relation_tag tag1]] == 2} + aa_true "Verify links to one object with multiple link tags" \ - {[llength [application_data_link::get -object_id $o(0) -relation_tag tag2]] == 1} + {[llength [application_data_link::get -object_id $o(0) -relation_tag tag2]] == 1} } } + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl 25 Jul 2018 03:10:58 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/test/community-core-test-procs.tcl 25 Jul 2018 13:42:48 -0000 1.8 @@ -3,13 +3,15 @@ @author byron Haroldo Linares Roman (bhlr@galileo.edu) @creation-date 2006-07-28 - @arch-tag: 0D0EAC28-2481-4BEE-9645-A143B939DBCA @cvs-id $Id$ } aa_register_case \ -cats {api smoke} \ - -procs {cc_lookup_email_user cc_email_from_party} \ + -procs { + party::email + party::get_by_email + } \ community_cc_procs \ { test community core procs returned values @@ -32,10 +34,20 @@ } aa_register_case \ -cats {api smoke} \ - -procs {person::person_p person::get person::new person::update person::get_bio person::update_bio} \ + -procs { + party::email + person::delete + person::get + person::get_bio + person::name + person::new + person::person_p + person::update + person::update_bio + } \ person_procs_test \ { - test if the values returned by the person procs are correct + Test whether the values returned by the person procs are correct. } { set user_id [db_nextval acs_object_id_seq] @@ -96,7 +108,10 @@ aa_register_case \ -cats {api smoke} \ - -procs {party::get_by_email party::update} \ + -procs { + party::get_by_email + party::update + } \ party_procs_test \ { test if the values returned by the party procs are correct @@ -110,8 +125,13 @@ set last_name [ad_generate_random_string] set url "url[ad_generate_random_string]" - array set user_info [auth::create_user -user_id $user_id -username $username -email $email -first_names $first_names \ - -last_name $last_name -password $password \ + array set user_info [auth::create_user \ + -user_id $user_id \ + -username $username \ + -email $email \ + -first_names $first_names \ + -last_name $last_name \ + -password $password \ -secret_question [ad_generate_random_string] \ -secret_answer [ad_generate_random_string]] Index: openacs-4/packages/acs-tcl/tcl/test/datamodel-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/datamodel-test-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-tcl/tcl/test/datamodel-test-procs.tcl 19 Jul 2018 11:17:53 -0000 1.18 +++ openacs-4/packages/acs-tcl/tcl/test/datamodel-test-procs.tcl 25 Jul 2018 13:42:48 -0000 1.19 @@ -7,10 +7,16 @@ } -aa_register_case -cats {db smoke production_safe} -error_level warning datamodel__named_constraints { - Check that all the constraints meet the constraint naming standards. +aa_register_case \ + -cats {db smoke production_safe} \ + -error_level warning \ + -procs {} \ + datamodel__named_constraints { + + Check that all the constraints meet the constraint naming + standards. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { set db_is_pg_p [string equal [db_name] "PostgreSQL"] @@ -94,11 +100,15 @@ -aa_register_case -cats {db smoke production_safe} datamodel__acs_object_type_check { - Check that the object type tables exist and that the id column is present and the - name method works. +aa_register_case \ + -cats {db smoke production_safe} \ + -procs {db_table_exists} \ + datamodel__acs_object_type_check { + + Check that the object type tables exist and that the id column is + present and the name method works. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { db_foreach object_type {select * from acs_object_types} { if {[string tolower $table_name] ne $table_name } { @@ -152,11 +162,15 @@ -aa_register_case -cats {db smoke production_safe} datamodel__acs_attribute_check { - Check that the acs_attribute column is present and the datatype is vaguely - consistent with the db datatype. +aa_register_case \ + -cats {db smoke production_safe} \ + -procs {db_column_type db_columns} \ + datamodel__acs_attribute_check { + + Check that the acs_attribute column is present and the + datatype is vaguely consistent with the db datatype. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { array set allow_types { string {TEXT VARCHAR CHAR VARCHAR2} @@ -173,7 +187,11 @@ keyword {CHAR VARCHAR TEXT VARCHAR2} } - db_foreach attribute {select a.*, lower(ot.table_name) as obj_type_table from acs_attributes a, acs_object_types ot where ot.object_type = a.object_type order by a.object_type} { + db_foreach attribute { + select a.*, lower(ot.table_name) as obj_type_table + from acs_attributes a, acs_object_types ot + where ot.object_type = a.object_type order by a.object_type + } { if {[string tolower $table_name] ne $table_name } { aa_log_result fail "Type $object_type attribute $table_name.$attribute_name mixed case" @@ -193,7 +211,7 @@ } set column_name [string tolower $column_name] - if {[lsearch $columns($obj_type_table) $column_name] < 0} { + if {$column_name ni $columns($obj_type_table)} { aa_log_result fail "Type $object_type attribute column $column_name not found in $obj_type_table" } else { # check the type of the column is vaguely like the acs_datatype type. @@ -202,7 +220,7 @@ if {$actual_type eq "-1"} { aa_log_result fail "Type $object_type attribute $attribute_name database type get for ($table_name.$column_name) failed" } else { - if {[lsearch $allow_types($datatype) $actual_type] < 0} { + if {$actual_type ni $allow_types($datatype)} { aa_log_result fail "Type $object_type attribute $attribute_name database type was $actual_type for $datatype" } } Index: openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl 24 Jul 2018 19:29:24 -0000 1.13 +++ openacs-4/packages/acs-tcl/tcl/test/doc-check-procs.tcl 25 Jul 2018 13:42:48 -0000 1.14 @@ -187,12 +187,12 @@ foreach param_doc $params { set param [lindex [string map $ignorechars $param_doc] 0] if {"$param" ni $real_params} { - # Nonexistant @param found! + # Nonexistent @param found! incr param_unknown aa_log_result fail "Unknown parameter '$param' in documentation of proc '$p'" } } - # Just count the number of procs without nonexistant @params + # Just count the number of procs without nonexistent @params if { $param_unknown == 0 } { incr good } @@ -201,6 +201,63 @@ aa_log "@param names seem coherent with the actual proc parameters in $good of $count checked procs" } +if {[parameter::get \ + -package_id [apm_package_id_from_key acs-api-browser] \ + -parameter IncludeCallingInfo \ + -default false]} { + + aa_register_case \ + -cats {smoke production_safe} \ + -error_level warning \ + cross_package_called_private_functions { + + Search for cross-package calls of private functions. + + @author Gustaf Neumann + + @creation-date 2018-07-25 + } { + set count 0 + set fails 0 + set private 0 + + foreach called [lsort -dictionary [nsv_array names api_proc_doc]] { + incr count + set called_by_count 0 + set called_info [nsv_get api_proc_doc $called] + if {[dict exists $called_info calledby] + && [dict exists $called_info script] + && [dict exists $called_info protection] + && [dict get $called_info protection] eq "private" + } { + incr private + regexp {^packages/([^/]+)/} [dict get $called_info script] . called_package_key + foreach caller [lsort [dict get $called_info calledby]] { + incr called_by_count + if {[nsv_get api_proc_doc $caller caller_info] + && [dict exists $caller_info script] + && ![string match "AcsSc.*" $caller] + } { + regexp {^packages/([^/]+)/} [dict get $caller_info script] . caller_package_key + if {$caller_package_key ne $called_package_key} { + incr fails + set msg "" + append msg \ + "private function <$called_package_key $called> " \ + "called by <$caller_package_key $caller>
" \ + [dict get $called_info script] "
" \ + [dict get $caller_info script] + aa_log_result fail $msg + } + } + } + ns_log notice "private function $called called by $called_by_count functions" + } + } + aa_log "Found $fails cross-package private calls out of a total of $private private calls (total: $count call sites)" + } +} + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-tcl/tcl/test/file-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/file-test-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/acs-tcl/tcl/test/file-test-procs.tcl 24 Jul 2018 14:47:15 -0000 1.18 +++ openacs-4/packages/acs-tcl/tcl/test/file-test-procs.tcl 25 Jul 2018 13:42:48 -0000 1.19 @@ -6,10 +6,14 @@ @cvs-id $Id$ } -aa_register_case -cats {smoke production_safe} files__tcl_file_syntax_errors { - Test all known Tcl files for successful parsing "(in the [info complete] sense at least)" and other common errors. +aa_register_case \ + -cats {smoke production_safe} \ + -procs {apm_get_installed_versions apm_get_package_files} \ + files__tcl_file_syntax_errors { + + Test all known Tcl files for successful parsing "(in the [info complete] sense at least)" and other common errors. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { # if startdir is not $::acs::rootdir/packages, then somebody checked in the wrong thing by accident set startdir $::acs::rootdir/packages @@ -38,7 +42,11 @@ } } -aa_register_case -cats {smoke production_safe} -error_level error files__tcl_file_common_errors { +aa_register_case \ + -cats {smoke production_safe} \ + -error_level error \ + -procs {} \ + files__tcl_file_common_errors { Check for some common error patterns. @author Jeff Davis davis@xarg.net @@ -56,8 +64,9 @@ #inspect every Tcl file in the directory tree starting with $startdir foreach file [ad_find_all_files -check_file_func ::tcl_p $startdir] { - if {[string match "*/acs-tcl/tcl/test/file-test-procs.tcl" $file]} continue - + if {[string match "*/acs-tcl/tcl/test/file-test-procs.tcl" $file]} { + continue + } set fp [open $file "r"] set data [read $fp] close $fp @@ -69,11 +78,15 @@ aa_log "Checked $count Tcl files" } -aa_register_case -cats {smoke production_safe} files__check_info_files { - Check that all the info files parse correctly and are - internally consistent. +aa_register_case \ + -cats {smoke production_safe} \ + -procs {apm_read_package_info_file} \ + files__check_info_files { + + Check that all the info files parse correctly and are + internally consistent. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { foreach spec_file [glob -nocomplain "$::acs::rootdir/packages/*/*.info"] { set errp 0 @@ -119,10 +132,19 @@ } } -aa_register_case -cats {smoke production_safe} files__check_upgrade_ordering { - Check that all the upgrade files are well ordered (non-overlapping and v1 > v2) +aa_register_case \ + -cats {smoke production_safe} \ + -procs { + apm_get_package_files + apm_guess_db_type + apm_version_sortable + } \ + files__check_upgrade_ordering { + + Check that all the upgrade files are well ordered + (non-overlapping and v1 > v2). - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { foreach dir [lsort [glob -nocomplain -types f "$::acs::rootdir/packages/*/*.info"]] { @@ -180,13 +202,22 @@ } } -aa_register_case -cats {smoke} files__check_xql_files { - Check for some common errors in the xql files like - missing rdbms, missing corresponding Tcl files, etc. +aa_register_case \ + -cats {smoke} \ + -procs { + apm_get_installed_versions + apm_get_package_files + db_qd_internal_prepare_queryfile_content + xml_parse + } \ + files__check_xql_files { + + Check for some common errors in the xql files like + missing rdbms, missing corresponding Tcl files, etc. - Not production safe since malformed xql can crash AOLserver in the parse. + Not production safe since malformed xql can crash AOLserver in the parse. - @author Jeff Davis davis@xarg.net + @author Jeff Davis davis@xarg.net } { # if startdir is not $::acs::rootdir/packages, then somebody checked in the wrong thing by accident set startdir $::acs::rootdir/packages @@ -290,16 +321,19 @@ } } -aa_register_case -cats {production_safe} -error_level notice files__trailing_whitespace { +aa_register_case \ + -cats {production_safe} \ + -error_level notice \ + -procs {} \ + files__trailing_whitespace { - Looks for trailing whitespace: spaces or tabs at the end of lines. + Looks for trailing whitespace: spaces or tabs at the end of lines. + Currently, only checks on .tcl files. - Currently, only checks on .tcl files. + @author Héctor Romojaro - @author Héctor Romojaro + @creation-date 2018-07-24 - @creation-date 2018-07-24 - } { # if startdir is not $::acs::rootdir/packages, then somebody checked in the wrong thing by accident set startdir $::acs::rootdir/packages @@ -347,7 +381,11 @@ aa_log "$good of $count tcl files checked have no trailing whitespace" } -aa_register_case -cats {smoke production_safe} -error_level warning files__page_contracts { +aa_register_case \ + -cats {smoke production_safe} \ + -error_level warning \ + -procs {} \ + files__page_contracts { Checks for files without 'ad_page_contract' or 'ad_include_contract' in both 'www' and 'lib' package directories. Index: openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl,v diff -u -r1.17 -r1.18 --- openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 22 Jul 2018 09:58:43 -0000 1.17 +++ openacs-4/packages/acs-tcl/tcl/test/html-conversion-procs.tcl 25 Jul 2018 13:42:48 -0000 1.18 @@ -6,22 +6,25 @@ } -aa_register_case -cats {api smoke} ad_html_to_text_bold { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_to_text} \ + ad_html_to_text_bold { Test if it converts b tags correctly. } { - set html "Some bold test" - set result [ad_html_to_text -- $html] - aa_true "contains asterisks?" [regexp {\*bold\*} $result] - } -aa_register_case -cats {api smoke} -bugs 386 -error_level warning \ +aa_register_case \ + -cats {api smoke} \ + -bugs 386 \ + -error_level warning \ + -procs {ad_html_to_text} \ ad_html_to_text_clipped_link { Test if it converts clipped links. @@ -49,29 +52,34 @@ } -aa_register_case -cats {api smoke} ad_html_security_check_href_allowed { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_security_check} \ + ad_html_security_check_href_allowed { tests is href attribute is allowed of A tags } { set html "An Link" - aa_true "href is allowed for A tags" [string equal [ad_html_security_check $html] ""] + aa_equals "href is allowed for A tags" [ad_html_security_check $html] "" } -aa_register_case -cats {api smoke} util_close_html_tags { +aa_register_case \ + -cats {api smoke} \ + -procs {util_close_html_tags} \ + util_close_html_tags { Tests closing HTML tags. } { aa_equals "" [util_close_html_tags "Foobar"] "Foobar" - aa_equals "" [util_close_html_tags "Foobar"] "Foobar" - aa_equals "" [util_close_html_tags "Foobar is a very long word"] "Foobar is a very long word" - aa_equals "" [util_close_html_tags "Foobar is a very long word" 15] "Foobar is a" - aa_equals "" [util_close_html_tags "Foobar is a very long word" 0 20 "..."] "Foobar is a very..." } -aa_register_case -cats {api smoke} ad_html_text_convert { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_text_convert ad_enhanced_text_to_html} \ + ad_html_text_convert { Testing ad_html_text_convert. } { #---------------------------------------------------------------------- @@ -90,7 +98,7 @@ # from text/markdown #---------------------------------------------------------------------- - if {[expr ![catch {package present Markdown}]]} { + if {![catch {package present Markdown}]} { set string "What?\n*Never mind, buddy*" aa_equals "" [ad_html_text_convert -from "text/markdown" -to "text/html" -truncate_len 14 -- $string] \ @@ -138,11 +146,21 @@ "What?\n_Never..." set long_string [string repeat "Very long text. " 10] - aa_equals "No truncation" [ad_html_text_convert -from "text/html" -to "text/html" -truncate_len [string length $long_string] -- $long_string] $long_string + aa_equals "No truncation" \ + [ad_html_text_convert \ + -from "text/html" \ + -to "text/html" \ + -truncate_len [string length $long_string] \ + -- \ + $long_string] \ + $long_string } -aa_register_case -cats {api smoke} string_truncate { +aa_register_case \ + -cats {api smoke} \ + -procs {string_truncate} \ + string_truncate { Testing string truncation } { aa_equals "" [string_truncate -len 5 -ellipsis "" -- "foo"] "foo" @@ -173,10 +191,13 @@ set long_string [string repeat "Very long text. " 100] aa_equals "No truncation" [string_truncate -len [string length $long_string] -- $long_string] $long_string - } -aa_register_case -cats {api smoke} -procs {util_convert_line_breaks_to_html} util_convert_line_breaks_to_html { + +aa_register_case \ + -cats {api smoke} \ + -procs {util_convert_line_breaks_to_html} \ + util_convert_line_breaks_to_html { Test if it converts spaces and line breaks correctly. } { #Convert leading and trailing spaces or tabs @@ -205,7 +226,10 @@ } -aa_register_case -cats {api smoke} -procs {ad_quotehtml ad_unquotehtml} quote_unquote_html { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_unquotehtml} \ + quote_unquote_html { Test if it quote and unquote html } { #quote html @@ -218,10 +242,13 @@ set html $result aa_log "Quote html=$html" set result [ad_unquotehtml $html] - aa_true "Unquote html=$result" [string equal "\"<&text>\"" $result] + aa_equals "Unquote html=$result" "\"<&text>\"" $result } -aa_register_case -cats {api smoke} -procs {ad_looks_like_html_p} ad_looks_like_html_p { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_looks_like_html_p} \ + ad_looks_like_html_p { Test if it guess the text supplied is html } { set html "Home Page" @@ -237,16 +264,22 @@ aa_true "Is html text" [ad_looks_like_html_p $html] } -aa_register_case -cats {api smoke} -procs {util_remove_html_tags} util_remove_html_tags { +aa_register_case \ + -cats {api smoke} \ + -procs {util_remove_html_tags} \ + util_remove_html_tags { Test if it remove all between tags } { set html "

some text to probe if it remove all between \"<\" and \">\"
" set result [util_remove_html_tags $html] - aa_true "Without all between \"<\" and \">\" html=\"$result\""\ - [string equal "some text to probe if it remove all between \"\"" $result] + aa_equals "Without all between \"<\" and \">\" html=\"$result\""\ + "some text to probe if it remove all between \"\"" $result } -aa_register_case -cats {api smoke} -procs {ad_parse_html_attributes} ad_parse_html_attributes { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_parse_html_attributes} \ + ad_parse_html_attributes { Test if returns a list of attributes inside an HTML tag } { set pos 5 @@ -270,8 +303,11 @@ aa_equals "Attributes - $result" $result {{foo bar} {greeting {welcome home}} {ja blah}} } -aa_register_case -cats {api smoke} -procs {ad_html_text_convert} ad_text_html_convert_outlook_word_comments { - Test is MS Word HTML Comments are stripped or not +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_text_convert} \ + ad_text_html_convert_outlook_word_comments { + Test whether HTML comments inserted by MS Word are stripped } { set html {} @@ -316,7 +352,10 @@ } -aa_register_case -cats {api smoke} -procs {ad_html_text_convert} ad_text_html_convert_to_plain { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_text_convert} \ + ad_text_html_convert_to_plain { Test rendering of a more or less standard HTML text } { @@ -393,10 +432,116 @@ [string first { This is *bold} $result] > 0 } +} +aa_register_case \ + -cats {api} \ + -bugs 1450 \ + -procs {ad_enhanced_text_to_html} \ + acs_tcl__process_enhanced_correctly { + + Process sample text correctly + @author Nima Mazloumi + } { + + set string_with_img {} + aa_log "Original string is $string_with_img" + set html_version [ad_enhanced_text_to_html $string_with_img] + aa_equals "new: $html_version should be the same" $html_version $string_with_img +} +aa_register_case \ + -cats {api smoke} \ + -procs {ad_html_to_text} \ + text_to_html { + + Test code the supposedly causes ad_html_to_text to break +} { + + # Test bad <<<'s + + set offending_post {><<<} + set errno [catch { set text_version [ad_html_to_text -- $offending_post] } errmsg] + + if { ![aa_equals "Does not bomb" $errno 0] } { + aa_log "errmsg: $errmsg" + aa_log "errorInfo: $::errorInfo" + } else { + aa_equals "Expected identical result" $text_version $offending_post + } + + # Test offending post sent by Dave Bauer + + set offending_post { +I have a dynamically assigned ip address, so I use dyndns.org to +change +addresses for my acs server. +Mail is sent to any yahoo address fine. Mail sent to aol fails. I am +not running a dns server on my acs box. What do I need to do to +correct this problem?
+Here's my error message:
+ Mail Delivery Subsystem
+ | Block + Address | Add to Address Book
+ To: + gmt3rd@yahoo.com
+ Subject: + Returned mail: Service unavailable +

+ + +The original message was received at Sat, 17 Mar 2001 11:48:57 -0500 +from IDENT:nsadmin@localhost [127.0.0.1] +
+ ----- The following addresses had permanent fatal errors ----- +gmt3rd@aol.com +
+ ----- Transcript of session follows -----

+... while talking to mailin-04.mx.aol.com.: +<<< 550-AOL no longer accepts connections from dynamically assigned +<<< 550-IP addresses to our relay servers. Please contact your ISP +<<< 550 to have your mail redirected through your ISP's SMTP servers. +... while talking to mailin-02.mx.aol.com.: +>>> QUIT +

+ + Attachment: Message/delivery-status + +Reporting-MTA: dns; testdsl.homeip.net +Received-From-MTA: DNS; localhost +Arrival-Date: Sat, 17 Mar 2001 11:48:57 -0500 + +Final-Recipient: RFC822; gmt3rd@aol.com +Action: failed +Status: 5.5.0 +Remote-MTA: DNS; mailin-01.mx.aol.com +Diagnostic-Code: SMTP; 550-AOL no longer accepts connections from +dynamically assigned +Last-Attempt-Date: Sat, 17 Mar 2001 11:48:57 -0500 + +

+

+anybody have any ideas? + } + + set errno [catch { set text_version [ad_html_to_text -- $offending_post] } errmsg] + + if { ![aa_equals "Does not bomb" $errno 0] } { + aa_log "errmsg: $errmsg" + aa_log "errorInfo: $::errorInfo" + } else { + aa_log "Text version: $text_version" + } + + # Test placement of [1] reference + set html {Here is http://openacs.org my friend} + + set text_version [ad_html_to_text -- $html] + + aa_log "Text version: $text_version" } + # Local variables: # mode: tcl # tcl-indent-level: 4 Index: openacs-4/packages/acs-tcl/tcl/test/html-email-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/html-email-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/test/html-email-procs.tcl 27 Mar 2018 11:18:00 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/test/html-email-procs.tcl 25 Jul 2018 13:42:48 -0000 1.5 @@ -2,7 +2,10 @@ Test html email procs } -aa_register_case -cats {api smoke} build_mime_message { +aa_register_case \ + -cats {api smoke} \ + -procs {build_mime_message} \ + build_mime_message { Basic test of build mime message } { aa_false "Build mime message, no error" \ Index: openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl 7 Aug 2017 23:48:00 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/test/memoizing-procs.tcl 25 Jul 2018 13:42:48 -0000 1.4 @@ -28,7 +28,10 @@ return $response } -aa_register_case -cats {api smoke} ad_proc_cache { +aa_register_case \ + -cats {api smoke} \ + -procs {util_memoize util_memoize_cached_p} \ + util_memoize_cache { Test cache of a proc executed before } { aa_log "caching a proc" @@ -39,7 +42,10 @@ aa_equals "proc was cached successful" $success_p 1 } -aa_register_case -cats {api smoke} ad_proc_flush { +aa_register_case \ + -cats {api smoke} \ + -procs {util_memoize util_memoize_cached_p util_memoize_flush_regexp} \ + util_memoize_cache_flush { Test flush of a proc cached } { aa_log "caching" Index: openacs-4/packages/acs-tcl/tcl/test/navigation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/navigation-procs.tcl,v diff -u -r1.11 -r1.12 --- openacs-4/packages/acs-tcl/tcl/test/navigation-procs.tcl 25 Jul 2018 02:51:32 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/test/navigation-procs.tcl 25 Jul 2018 13:42:48 -0000 1.12 @@ -43,17 +43,14 @@ } -aa_register_case -cats { - api - smoke -} -procs { +aa_register_case \ + -cats {api smoke} \ + -procs { + ad_context_bar_html + } ad_context_bar_html { - ad_context_bar_html + Test if returns a HTML fragment from a list. -} ad_context_bar_html { - - Test if returns a html fragment from a list. - } { set ref_list [list [list "/doc/doc0.html" "href0"] [list "/doc/doc1.html" "href1"] [list "/doc/doc2.html" "href2"]] @@ -62,8 +59,8 @@ set separator "-" aa_log "List with three references:\n\n$c\nseparator= \" - \" " - aa_equals "" [ad_context_bar_html -separator $separator $ref_list] "[lindex $ref_list 0 1] - [lindex $ref_list 1 1] - [lindex $ref_list 2 0] [lindex $ref_list 2 1]" - + aa_equals "" [ad_context_bar_html -separator $separator $ref_list] \ + "[lindex $ref_list 0 1] - [lindex $ref_list 1 1] - [lindex $ref_list 2 0] [lindex $ref_list 2 1]" } aa_register_case -cats { @@ -76,7 +73,7 @@ site_node::new } ad_context_bar { - Test if returns a well formed context_bar in html format from a site node. + Test if returns a well formed context_bar in HTML format from a site node. } { @@ -100,7 +97,7 @@ # Create hierarchy from the random created nodes db_1row query { - select MIN(node_id) as first_node from site_nodes + select min(node_id) as first_node from site_nodes } set idp $first_node set idr_1 [site_node::new -name $random1 -parent_id $idp] @@ -129,12 +126,8 @@ #aa_log "bar_components $bar_components" set context_barp "" foreach value $bar_components { - append context_barp "" - append context_barp [lindex $value 1] - append context_barp "" - append context_barp " $separator " + append context_barp \ + [subst {[lindex $value 1] $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -node_id $idr_1 -separator $separator $leave_node] @@ -150,12 +143,8 @@ set bar_components [list $root_node $testnode_1 $testnode_2 $admin_node] set context_barp "" foreach value $bar_components { - append context_barp "" - append context_barp [lindex $value 1] - append context_barp "" - append context_barp " $separator " + append context_barp \ + [subst {[lindex $value 1] $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -node_id $idr_2 -separator $separator $leave_node] @@ -169,31 +158,25 @@ set bar_components [list $testnode_1 $testnode_2 $admin_node] set context_barp "" foreach value $bar_components { - append context_barp "" - append context_barp [lindex $value 1] - append context_barp "" - append context_barp " $separator " + append context_barp \ + [subst {[lindex $value 1] $separator }] } append context_barp "$leave_node" set context_bar [ad_context_bar -from_node $idr_1 -node_id $idr_2 -separator $separator $leave_node] aa_equals "Context_bar = $context_barp" $context_bar $context_barp } } -aa_register_case -cats { - api - smoke - web -} -libraries tclwebtest -procs { +aa_register_case \ + -cats {api smoke web} \ + -libraries tclwebtest \ + -procs { + ad_context_bar_multirow + } \ + ad_context_bar_multirow { - ad_context_bar_multirow - -} ad_context_bar_multirow { + Test if returns a well formed context_bar in HTML format from a site node in a multirow. - Test if returns a well formed context_bar in html format from a site node in a multirow. - } { # Setup nodes from the context bar, create two nodes to include set separator "" Index: openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl 7 Aug 2017 23:48:00 -0000 1.7 +++ openacs-4/packages/acs-tcl/tcl/test/object-test-case-procs.tcl 25 Jul 2018 13:42:48 -0000 1.8 @@ -1,19 +1,17 @@ -# - ad_library { - - @author byron Haroldo Linares Roman (bhlr@galileo.edu) @creation-date 2006-08-11 - @arch-tag: E1207E78-A4E3-4DC7-BEB7-49EA35B99D69 @cvs-id $Id$ } aa_register_case \ -cats {api smoke} \ - -procs {acs_object::get acs_object::get_element acs_object::set_context_id} \ - acs_object_procs_test \ + -procs { + acs_object::get + acs_object::get_element + acs_object::set_context_id + } acs_object_procs_test \ { test the acs_object::* procs } { Index: openacs-4/packages/acs-tcl/tcl/test/openacs-kernel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/openacs-kernel-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/acs-tcl/tcl/test/openacs-kernel-procs.tcl 7 Aug 2017 23:48:00 -0000 1.3 +++ openacs-4/packages/acs-tcl/tcl/test/openacs-kernel-procs.tcl 25 Jul 2018 13:42:48 -0000 1.4 @@ -3,7 +3,10 @@ @creation-date 03 August 2006 } -aa_register_case -cats {api smoke} -procs {oacs_util::csv_foreach} csv_foreach { +aa_register_case \ + -cats {api smoke} \ + -procs {oacs_util::csv_foreach} \ + csv_foreach { Test block execution for rows in a csv file. } { aa_run_with_teardown -test_code { @@ -24,21 +27,26 @@ aa_log "CSV file created with artists data:\n $csv_data" set artist_list {} - oacs_util::csv_foreach -file $file_loc -array_name row\ - { - lappend artist_list "$row(first_name) $row(last_name) - $row(instrument)" - } + oacs_util::csv_foreach -file $file_loc -array_name row { + lappend artist_list "$row(first_name) $row(last_name) - $row(instrument)" + } aa_equals "Getting artists from csv file" $artist_list {{Charles Mingus - Bass}\ - {Miles Davis - Trumpet}\ - {Jhon Coltrane - Saxo}\ - {Charlie Parker - Saxo}\ - {Thelonius Monk - Piano}} + {Miles Davis - Trumpet}\ + {Jhon Coltrane - Saxo}\ + {Charlie Parker - Saxo}\ + {Thelonius Monk - Piano}} } -teardown_code { file delete -force -- $file_loc } } -aa_register_case -cats {api smoke} -procs {oacs_util::process_objects_csv} process_objects_csv { +aa_register_case \ + -cats {api smoke} \ + -procs { + oacs_util::process_objects_csv + person::get + } \ + process_objects_csv { Test object creation for every row in a csv file. } { aa_run_with_teardown -rollback -test_code { @@ -66,8 +74,8 @@ lappend person_list "$person_array(first_names) $person_array(last_name)" } aa_equals "Getting persons from database table \"persons\"" $person_list {{Charles Mingus}\ - {Miles Davis}\ - {Charlie Parker}} + {Miles Davis}\ + {Charlie Parker}} } -teardown_code { file delete -force -- $file_loc } Index: openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl 22 Jul 2018 09:58:43 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/test/test-membership-rel-procs.tcl 25 Jul 2018 13:42:48 -0000 1.5 @@ -4,20 +4,31 @@ @author Cesar Hernandez (cesarhj@galileo.edu) @creation-date 2006-07-31 - @arch-tag: 92464550-0231-4D33-8885-595623B00DB6 @cvs-id $Id$ } -aa_register_case -cats {api smoke} ad_proc_change_state_member { +aa_register_case \ + -cats {api smoke} \ + -procs { + acs_user::get + membership_rel::approve + membership_rel::ban + membership_rel::delete + membership_rel::reject + membership_rel::unapprove + } \ + ad_proc_change_state_member { Test the proc change_state } { - #we get a user_id as party_id - set user_id [db_nextval acs_object_id_seq] aa_run_with_teardown -rollback -test_code { + + #we get a user_id as party_id + set user_id [db_nextval acs_object_id_seq] + #Create the user - array set user_info [twt::user::create -user_id $user_id] + set user_info [acs::test::user::create -user_id $user_id] set rel_id [db_string get_rel_id "select max(rel_id) from acs_rels where object_id_two = :user_id" -default 0] #Try to change his state to approved @@ -26,7 +37,7 @@ acs_user::get -user_id $user_id -array user #Verifying if the state was changed - aa_equals "Changed State to aprroved" \ + aa_equals "Changed State to aprroved" \ $user(member_state) "approved" @@ -36,7 +47,7 @@ acs_user::get -user_id $user_id -array user #Verifying if the state was changed - aa_equals "Changed State to banned" \ + aa_equals "Changed State to banned" \ $user(member_state) "banned" @@ -46,7 +57,7 @@ acs_user::get -user_id $user_id -array user #Verifying if the state was changed - aa_equals "Changed State to rejected" \ + aa_equals "Changed State to rejected" \ $user(member_state) "rejected" @@ -65,10 +76,8 @@ acs_user::get -user_id $user_id -array user #Verifying if the state was changed - aa_equals "Changed State to deleted" \ + aa_equals "Changed State to deleted" \ $user(member_state) "deleted" - - } } # Local variables: Index: openacs-4/packages/acs-tcl/tcl/test/test-permissions-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/test-permissions-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/acs-tcl/tcl/test/test-permissions-procs.tcl 19 Jul 2018 11:43:19 -0000 1.5 +++ openacs-4/packages/acs-tcl/tcl/test/test-permissions-procs.tcl 25 Jul 2018 13:42:48 -0000 1.6 @@ -1,25 +1,32 @@ -# - ad_library { Test for Permission Procedures @author Cesar Hernandez (cesarhj@galileo.edu) @creation-date 2006-07-14 - @arch-tag: 0823E65B-D0B0-417A-AB6F-CA86E0461A8E @cvs-id $Id$ } -aa_register_case -cats {api smoke} ad_proc_permission_grant_and_revoke { +aa_register_case \ + -cats {api smoke} \ + -procs { + permission::grant + permission::permission_p + permission::revoke + site_node::instantiate_and_mount + } \ + ad_proc_permission_grant_and_revoke { - Test for Permission Procedures of grant and revoke. + Test for permission procedures of grant and revoke. } { - # We get an user_id as party_id. - set user_id [db_nextval acs_object_id_seq] aa_run_with_teardown -rollback -test_code { + # We get an user_id as party_id. + set user_id [db_nextval acs_object_id_seq] + # Create the user - array set user_info [twt::user::create -user_id $user_id] + set user_info [acs::test::user::create -user_id $user_id] + # Create and mount new subsite to test the permissions on this # instance. set site_name [ad_generate_random_string] @@ -82,16 +89,26 @@ } } -aa_register_case -cats {api smoke} ad_proc_permission_permission_p { +aa_register_case \ + -cats {api smoke} \ + -procs { + permission::grant + permission::permission_p + permission::revoke + site_node::instantiate_and_mount + } \ + ad_proc_permission_permission_p { Test for Permission Procedures of permission_p } { - # We get an user_id as party_id. - set user_id [db_nextval acs_object_id_seq] aa_run_with_teardown -rollback -test_code { + # We get an user_id as party_id. + set user_id [db_nextval acs_object_id_seq] + # Create the user - array set user_info [twt::user::create -user_id $user_id] + set user_info [twt::user::create -user_id $user_id] + # Create and mount new subsite to test the permissions on this # instance set site_name [ad_generate_random_string] Index: openacs-4/packages/acs-tcl/tcl/test/test-set-cookie-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/test-set-cookie-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/acs-tcl/tcl/test/test-set-cookie-procs.tcl 22 Jul 2018 09:58:43 -0000 1.4 +++ openacs-4/packages/acs-tcl/tcl/test/test-set-cookie-procs.tcl 25 Jul 2018 13:42:48 -0000 1.5 @@ -1,17 +1,19 @@ -#/packages/acs-tcl/tcl/test - ad_library { Test Case for set_cookie procs @author Cesar Hernandez (cesarhj@galileo.edu) @creation-date 2006-08-10 - @arch-tag: 0AA7362F-83FF-4067-B391-A2F8D6918F3E @cvs-id $Id$ } aa_register_case \ -cats {web smoke} \ + -procs { + ad_get_cookie + ad_set_cookie + ad_set_signed_cookie + } \ test_set_cookie_procs \ { Test Case for testing if a cookie is fixed @@ -72,9 +74,12 @@ } } - aa_register_case \ -cats {web smoke} \ + -procs { + ad_get_client_property + ad_set_client_property + } \ client_properties \ { Test Case client properties Index: openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 4 Jul 2018 22:22:44 -0000 1.6 +++ openacs-4/packages/acs-tcl/tcl/test/text-html-procs.tcl 25 Jul 2018 13:42:48 -0000 1.7 @@ -6,7 +6,10 @@ } -aa_register_case -cats {api smoke} ad_dom_sanitize_html { +aa_register_case \ + -cats {web api smoke} \ + -procs {ad_dom_sanitize_html} \ + ad_dom_sanitize_html { Test if it HTML sanitization works as expected @@ -107,7 +110,7 @@ aa_true "$msg no js?" {$result eq $test_result} } - # Try test cases not allowing outer urls + # Try test cases not allowing outer URLs foreach \ msg $test_msgs \ test_case $test_cases \ @@ -136,28 +139,11 @@ set test_result [string trim $test_result] aa_true "$msg fixing markup?" {$result eq $test_result} } + + set d [acs::test::http /] + aa_equals "Start page of current server: Status code valid" [dict get $d status] 200 - # - # Maybe a temporary fix: when the server is configured with a - # wildcard IPv4 address 0.0.0.0 and the hostname "localhost", and - # localhost is mapped on the host to the IPv6 address "::1", then - # ns_http to http://localhost:.../ is rejected, while the - # connection to the current IPv4 address http://127.0.0.1:.../ - # succeeds. However, the determination of the current IP address - # requires NaviServer 4.99.17d3 or newer, so we can't assume, this - # works always. - # - set mylocation [util::configured_location]/ - if {![catch {set myip [ns_conn currentaddr]}]} { - set driver_info [util_driver_info] - set mylocation [util::join_location \ - -proto [dict get $driver_info proto] \ - -hostname $myip \ - -port [dict get $driver_info port]] - } - aa_log "trying to get start page from $mylocation" - array set r [util::http::get -url $mylocation] - set test_case $r(page) + set test_case [dict get $d body] set msg "Test case 6: in our index page is removing tags ok" set unallowed_tags {div style script} @@ -224,7 +210,10 @@ } -aa_register_case -cats {api smoke} ad_pad { +aa_register_case \ + -cats {api smoke} \ + -procs {ad_pad} \ + ad_pad { Test if ad_pad is working as expected Index: openacs-4/packages/acs-tcl/tcl/test/whos-online-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/whos-online-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/acs-tcl/tcl/test/whos-online-procs.tcl 19 Jul 2018 11:43:19 -0000 1.8 +++ openacs-4/packages/acs-tcl/tcl/test/whos-online-procs.tcl 25 Jul 2018 13:42:48 -0000 1.9 @@ -5,17 +5,18 @@ @creation-date 2006-08-02 } -aa_register_case -cats { - smoke production_safe web -} -libraries tclwebtest -procs { - whos_online::num_users - whos_online::set_invisible - whos_online::all_invisible_user_ids - whos_online::unset_invisible - whos_online::user_ids -} whos_online__check_online_visibility { - Check procs related with users online visibility -} { +aa_register_case \ + -cats { smoke production_safe web } \ + -procs { + whos_online::num_users + whos_online::set_invisible + whos_online::all_invisible_user_ids + whos_online::unset_invisible + whos_online::user_ids + } whos_online__check_online_visibility { + + Check procs related with users online visibility + } { set user_id [db_nextval acs_object_id_seq] @@ -29,52 +30,51 @@ aa_log "Logged users: $logged_users" # Login user - array set user_info [twt::user::create -admin -user_id $user_id] - twt::user::login $user_info(email) $user_info(password) - + set user_info [acs::test::user::create -admin -user_id $user_id] + + set d [acs::test::http -user_id $user_id /] + set logged_users [whos_online::num_users] aa_true "New user logged - Users logged: $logged_users" { $logged_users > 0 } #--------------------------------------------------------------------------------------------------- #Test set_invisible #--------------------------------------------------------------------------------------------------- - aa_log "User $user_info(email) is visible" + aa_log "User [dict get $user_info email] is visible" whos_online::set_invisible $user_id - aa_true "User $user_info(email) is Invisible" {[nsv_exists invisible_users $user_id] == 1 } + aa_true "User [dict get $user_info email] is Invisible" {[nsv_exists invisible_users $user_id] == 1 } #--------------------------------------------------------------------------------------------------- #Test all-invisible_user_ids #--------------------------------------------------------------------------------------------------- - aa_true "User $user_info(email) with user_id=$user_id is in the invisible list" \ + aa_true "User [dict get $user_info email] user_id $user_id is in the invisible list ([whos_online::all_invisible_user_ids])" \ {$user_id in [whos_online::all_invisible_user_ids]} #--------------------------------------------------------------------------------------------------- #Test unset_invisible #--------------------------------------------------------------------------------------------------- - aa_log "User $user_info(email) is invisible" + aa_log "User [dict get $user_info email] is invisible" whos_online::unset_invisible $user_id - aa_false "User $user_info(email) is Visible" \ + aa_false "User [dict get $user_info email] is Visible" \ {[whos_online::user_invisible_p $user_id ] == 1 } #--------------------------------------------------------------------------------------------------- #Test user_ids #--------------------------------------------------------------------------------------------------- - aa_true "User $user_info(email) with user_id=$user_id is in the visible list" \ + aa_true "User [dict get $user_info email] user_id $user_id is in the visible list ([whos_online::user_ids])" \ {$user_id in [whos_online::user_ids]} - twt::user::logout - twt::user::delete -user_id $user_id } -teardown_code { - twt::user::delete -user_id $user_id + acs::test::user::delete -user_id $user_id } }