Index: openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl,v diff -u -r1.30 -r1.31 --- openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl 3 Mar 2006 01:05:08 -0000 1.30 +++ openacs-4/packages/acs-tcl/tcl/test/acs-tcl-test-procs.tcl 13 Jul 2006 17:22:17 -0000 1.31 @@ -1010,3 +1010,50 @@ } + +aa_register_case -cats {api smoke} parameter__check_procs { + Test the parameter::* procs + + @author Rocael Hernandez (roc@viaro.net) +} { + + db_foreach get_param { + select ap.parameter_name, ap.package_key, ap.default_value + from apm_parameters ap, apm_package_types apt + where + ap.package_key = apt.package_key + and apt.singleton_p ='t' + } { + + set value [random] + if {$value > 0.7} { + + set package_id [apm_package_id_from_key $package_key] + aa_log "$package_key $parameter_name $default_value" + aa_true "check parameter::get" [string equal [parameter::get -package_id $package_id -parameter $parameter_name] $default_value] + aa_true "check parameter::get_from_package_key" \ + [string equal [parameter::get_from_package_key -package_key $package_key -parameter $parameter_name] $default_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_true "check parameter::set_default" \ + [string equal $value $value_db] + + set value [expr $value + 10] + parameter::set_from_package_key -package_key $package_key -parameter $parameter_name -value $value + aa_true "check parameter::set_from_package_key" \ + [string equal $value [parameter::get -package_id $package_id -parameter $parameter_name]] + + set value [expr $value + 10] + parameter::set_value -package_id $package_id -parameter $parameter_name -value $value + aa_true "check parameter::set_value" \ + [string equal $value [parameter::get -package_id $package_id -parameter $parameter_name]] + + break; + } + } + +}