antoniop
committed
on 08 Mar 23
Test queuing, dequeuing
openacs-4/.../tcl/test/search-procs.tcl (+25 -3)
117 117                 }]
118 118             }
119 119         }
120 120
121 121         aa_true "Invalud event throws an error" [catch {
122 122             search::queue -object_id $object_id -event BOGUS
123 123         }]
124 124     }
125 125
126 126 aa_register_case \
127 127     -cats {api smoke} \
128 128     -procs {
129 129         search::driver_name
130 130         search::dotlrn::get_community_id
131 131     } \
132 132     misc {
133 133         Test miscellaneous api
134 134     } {
135 135         aa_section search::dotlrn::get_community_id
136 136
  137         #
  138         # This is the package we will test when no dotlrn is
  139         # there. Basically, any package will do.
  140         #
  141         set package_id [db_string get_applet_package {
  142             select max(package_id) from apm_packages
  143         }]
  144
137 145         if {[apm_package_installed_p dotlrn]} {
  146             #
  147             # We try testing a package coming from a community_applet
  148             # and fall back to any package in case we find none.
  149             #
  150             set package_id [db_string get_applet_package {
  151                 select coalesce((select max(package_id) from dotlrn_community_applets),
  152                                 :package_id)
  153                 from dual
  154             }]
  155
138 156             set site_node [site_node::get_node_id_from_object_id -object_id $package_id]
139               set dotlrn_package_id [site_node::closest_ancestor_package  -node_id $site_node  -package_key dotlrn  -include_self]
  157             set dotlrn_package_id [site_node::closest_ancestor_package \
  158                                        -node_id $site_node \
  159                                        -package_key dotlrn \
  160                                        -include_self]
140 161             set expected_community_id [db_string get_community_id {
141 162                 select community_id from dotlrn_communities_all
142 163                 where package_id = :dotlrn_package_id
143 164             } -default ""]
144 165         } else {
145 166             set expected_community_id ""
146 167         }
147 168
148           aa_equals "dotlrn community_id is returned as expected" \
149               [search::dotlrn::get_community_id] $expected_community_id
  169         aa_equals "dotlrn community_id is returned as expected for package '$package_id'" \
  170             [search::dotlrn::get_community_id -package_id $package_id] \
  171             $expected_community_id
150 172
151 173
152 174         aa_section search::driver_name
153 175
154 176         aa_equals "Driver name is returned as expected" \
155 177             [search::driver_name] \
156 178             [parameter::get \
157 179                  -package_id [apm_package_id_from_key search] \
158 180                  -parameter FtsEngineDriver]
159 181     }