|
1 | 1 | """ |
2 | 2 | Tests for stored queries involving a fulltext search: |
3 | | -* Generic fulltext_search (should be used with caution because it can be slow and timeout at 60s) |
4 | 3 | * Taxonomy taxonomy_search_species_strain |
5 | 4 | * Taxonomy taxonomy_search_species_strain_no_sort |
6 | 5 |
|
7 | 6 | The latter two are switched between depending on the length of the search text. |
8 | | -These stored query tests are all bundled in one test file because their original purpose is to do a species/strain |
9 | | -name search on the ncbi_taxon collection |
10 | 7 |
|
11 | 8 | These tests run within the re_api docker image, and require access to the ArangoDB, auth, and workspace images. |
12 | 9 | """ |
@@ -251,148 +248,6 @@ def test_prefix_hit(self): |
251 | 248 | ) |
252 | 249 |
|
253 | 250 |
|
254 | | -class TestFulltextSearchStoredQuery(unittest.TestCase): |
255 | | - @classmethod |
256 | | - def setUpClass(cls): |
257 | | - check_spec_test_env() |
258 | | - create_test_docs("ncbi_taxon", ncbi_taxa) |
259 | | - |
260 | | - def test_ncbi_taxon_scinames(self): |
261 | | - """Happy path""" |
262 | | - for sciname in scinames_test_all: |
263 | | - _fulltext_search_query( |
264 | | - self, |
265 | | - coll="ncbi_taxon", |
266 | | - search_attrkey="scientific_name", |
267 | | - search_text=sciname, |
268 | | - ts=_NOW if sciname in scinames_test_latest else None, |
269 | | - filter_attr_expr=[ |
270 | | - {"rank": "species"}, |
271 | | - {"rank": "strain"}, |
272 | | - {"strain": True}, |
273 | | - ], |
274 | | - offset=None, |
275 | | - limit=LIMIT, |
276 | | - select="scientific_name", |
277 | | - # --- |
278 | | - expect_error=False, |
279 | | - expect_hit=True, |
280 | | - ) |
281 | | - |
282 | | - def test_null_bind_params(self): |
283 | | - """Leave off parameters""" |
284 | | - for sciname in scinames_test_all: |
285 | | - _fulltext_search_query( |
286 | | - self, |
287 | | - coll="ncbi_taxon", |
288 | | - search_attrkey="scientific_name", |
289 | | - search_text=sciname, |
290 | | - ts=None, |
291 | | - filter_attr_expr=None, |
292 | | - offset=None, |
293 | | - limit=None, |
294 | | - select=None, |
295 | | - # --- |
296 | | - expect_error=False, |
297 | | - expect_hit=True, |
298 | | - ) |
299 | | - |
300 | | - def test_fully_specified_bind_params(self): |
301 | | - """Specify all parameters""" |
302 | | - for sciname in scinames_test_all: |
303 | | - _fulltext_search_query( |
304 | | - self, |
305 | | - coll="ncbi_taxon", |
306 | | - search_attrkey="scientific_name", |
307 | | - search_text=sciname, |
308 | | - ts=_NOW if sciname in scinames_test_latest else None, |
309 | | - filter_attr_expr=[ |
310 | | - {"rank": "species"}, |
311 | | - {"rank": "strain"}, |
312 | | - {"strain": True}, |
313 | | - ], |
314 | | - offset=0, |
315 | | - limit=LIMIT, |
316 | | - select=["id", "scientific_name"], |
317 | | - # --- |
318 | | - expect_error=False, |
319 | | - expect_hit=True, |
320 | | - ) |
321 | | - |
322 | | - def test_extra_params(self): |
323 | | - """Extra params not in spec/aql""" |
324 | | - _fulltext_search_query( |
325 | | - self, |
326 | | - coll="ncbi_taxon", |
327 | | - search_attrkey="scientific_name", |
328 | | - search_text="esch", |
329 | | - ts=None, |
330 | | - filter_attr_expr=[ |
331 | | - {"rank": "species"}, |
332 | | - {"rank": "strain"}, |
333 | | - {"strain": True}, |
334 | | - ], |
335 | | - offset=0, |
336 | | - limit=LIMIT, |
337 | | - select=["id", "scientific_name"], |
338 | | - extra_unused_param=42, |
339 | | - # --- |
340 | | - expect_error=("Additional properties are not allowed"), |
341 | | - ) |
342 | | - |
343 | | - def test_validation_fail(self): |
344 | | - _fulltext_search_query( |
345 | | - self, |
346 | | - coll=[], |
347 | | - search_attrkey=42, |
348 | | - search_text={"hi": 1}, |
349 | | - ts=None, |
350 | | - filter_attr_expr=None, |
351 | | - offset=None, |
352 | | - limit=None, |
353 | | - select=None, |
354 | | - # --- |
355 | | - expect_error="[] is not of type 'string'", |
356 | | - ) |
357 | | - |
358 | | - def test_aql_error(self): |
359 | | - for sciname in scinames_test_all: |
360 | | - _fulltext_search_query( |
361 | | - self, |
362 | | - coll="ncbi_taxon", |
363 | | - search_attrkey="fake_attrkey", |
364 | | - search_text=sciname, |
365 | | - ts=None, |
366 | | - filter_attr_expr=None, |
367 | | - offset=None, |
368 | | - limit=None, |
369 | | - select=None, |
370 | | - # --- |
371 | | - expect_error=True, |
372 | | - ) |
373 | | - |
374 | | - def test_no_hit(self): |
375 | | - for sciname in scinames_test_all: |
376 | | - _fulltext_search_query( |
377 | | - self, |
378 | | - coll="ncbi_taxon", |
379 | | - search_attrkey="scientific_name", |
380 | | - search_text=sciname[::-1], |
381 | | - ts=None, |
382 | | - filter_attr_expr=None, |
383 | | - offset=None, |
384 | | - limit=None, |
385 | | - select=None, |
386 | | - # --- |
387 | | - expect_error=False, |
388 | | - expect_hit=False, |
389 | | - expected_hits=[], |
390 | | - ) |
391 | | - |
392 | | - |
393 | | -# --- Test helpers --- |
394 | | - |
395 | | - |
396 | 251 | def _switch_taxonomy_search_species_strain_queries(search_text): |
397 | 252 | return ( |
398 | 253 | "taxonomy_search_species_strain_no_sort" |
|
0 commit comments