antoniop
committed
on 24 Apr 23
Test that "apm_get_package_files -all" should return all files for a package

This currently fails, as "-all" does not override the dbms cheā€¦ Show more
Test that "apm_get_package_files -all" should return all files for a package

This currently fails, as "-all" does not override the dbms check, so e.g. on a Postgres installation, all Oracle xql files would be skipped.

Note that the test uses acs-tcl as target because it is a package that is only supposed to contain "package-relevant" files. This is not a rule and is not the case in other packages such as acs-automated-testing, which creates many files during its operations that do not belong to the source tree.

Show less

openacs-4/.../test/30-apm-load-procs.tcl (+30 -0)
1 1 ad_library {
2 2     Tests for procs in tcl/30-apm-load-procs.tcl
3 3 }
4 4
5 5 aa_register_case \
6 6     -cats {api smoke} \
7 7     -procs {
  8         apm_get_package_files
  9         acs_package_root_dir
  10         ad_find_all_files
  11     } \
  12     get_package_files {
  13         Test apm_get_package_files
  14
  15         Note: this tests assumes that for a package such as acs-tcl,
  16         only "package-relevant" files are contained in the package
  17         folder. This is not a rule in general in OpenACS, e.g. the
  18         acs-automated-testing package may create many files during its
  19         operations that do not belong to the package source tree.
  20     } {
  21         set package_key acs-tcl
  22
  23         set package_files [apm_get_package_files -all -package_key $package_key]
  24
  25         set package_path [acs_package_root_dir $package_key]
  26         set package_length [string length $package_path]
  27         foreach f [ad_find_all_files $package_path] {
  28             set f [string range $f $package_length+1 end]
  29             aa_true "File '$f' belongs to '$package_key' and was found by the api" {
  30                 $f in $package_files
  31             }
  32         }
  33     }
  34
  35 aa_register_case \
  36     -cats {api smoke} \
  37     -procs {
8 38         ad_after_server_initialization
9 39     } \
10 40     ad_after_server_initialization {
11 41         Test ad_after_server_initialization proc
12 42     } {
13 43         set name test-30-apm-load-procs
14 44         set args "ns_log warning Test"
15 45
16 46         ad_after_server_initialization $name $args
17 47
18 48         set found_p false
19 49         foreach result [nsv_get ad_after_server_initialization .] {
20 50             if {[dict exists $result name] && [dict get $result name] eq $name} {
21 51                 set found_p true
22 52                 break
23 53             }
24 54         }
25 55         aa_true "Found our settings among the values" $found_p
26 56     }
27 57