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.6 -r1.7 --- openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl 17 Jul 2018 21:15:20 -0000 1.6 +++ openacs-4/packages/acs-tcl/tcl/test/acs-tcl-apm-procs.tcl 19 Jul 2018 09:55:12 -0000 1.7 @@ -10,64 +10,65 @@ apm_parameter_register } test_apm_parameter__register { Test the apm_parameter_register procedure - + @author Veronica De La Cruz (veronica@viaro.net) - + } { aa_run_with_teardown -rollback -test_code { set package_list [db_list get_packages "select package_key from apm_package_types"] - aa_log "List of packages:\{$package_list\}" + aa_log "List of packages: \{$package_list\}" set list_index [randomRange [expr {[llength $package_list] - 1}]] set package_key [lrange $package_list $list_index $list_index] - - set parameter_name [ad_generate_random_string] + + set parameter_name [ad_generate_random_string] set description [ad_generate_random_string] - + set values { {number} {string} } - set index [randomRange 1] - - # Choose randomly the parameter whether will be string or number. - # Also choose randomly its default value. - set datatype [lrange $values $index $index] + set index [randomRange 1] + + # + # Choose randomly string or numbner parameter. Also choose + # randomly its default value in the string case. + # + set datatype [lrange $values $index $index] if {$datatype eq "number"} { set default_value 0 } else { set default_value [ad_generate_random_string] } - - aa_log "Parameter to be added: name : $parameter_name \n descr: $description \n datatype: $datatype \n default_value: $default_value" - set parameter_id [apm_parameter_register $parameter_name $description $package_key $default_value $datatype] + aa_log "Parameter to be added: name $parameter_name\n descr $description\n datatype $datatype\n default_value $default_value" - aa_true "Parameter register succeeded" [expr {[info exists parameter_id] && $parameter_id ne ""}] - + set parameter_id [apm_parameter_register $parameter_name $description $package_key $default_value $datatype] + + aa_true "Parameter register succeeded" {$parameter_id ne ""} } } 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 { set package_list [db_list get_packages "select package_key from apm_package_types"] - aa_log "List of packages:\{$package_list\}" + aa_log "List of packages: \{$package_list\}" set list_index [randomRange [expr {[llength $package_list] - 1}]] set package_key [lrange $package_list $list_index $list_index] - - set instance_name $package_key + + set instance_name $package_key append instance_name "-[ad_generate_random_string]" - + aa_log "Package to be instantiated: $package_key" aa_log "Instance name to be added: $instance_name" - set error_occurred [catch {set package_id [apm_package_instance_new -package_key $package_key -instance_name $instance_name ]} err_men] + set error_occurred [catch { + set package_id [apm_package_instance_new -package_key $package_key -instance_name $instance_name ] + } err_men] aa_log "Error Message $error_occurred: $err_men " - aa_true "Setting the new instance succeeded" [expr {[info exists package_id] && $package_id ne ""}] - - + aa_true "Setting the new instance succeeded" {[info exists package_id] && $package_id ne ""} } }