@@ -332,12 +332,11 @@ def test_doc_search_hidden_versions(self, api_client, all_projects):
332
332
assert first_result ['project' ] == subproject .slug
333
333
334
334
@pytest .mark .parametrize ('doctype' , [SPHINX , SPHINX_SINGLEHTML , MKDOCS_HTML ])
335
- def test_search_correct_link_html_projects (self , api_client , doctype ):
335
+ def test_search_correct_link_for_normal_page_html_projects (self , api_client , doctype ):
336
336
project = Project .objects .get (slug = 'docs' )
337
337
project .versions .update (documentation_type = doctype )
338
338
version = project .versions .all ().first ()
339
339
340
- # Check for a normal page.
341
340
search_params = {
342
341
'project' : project .slug ,
343
342
'version' : version .slug ,
@@ -347,11 +346,15 @@ def test_search_correct_link_html_projects(self, api_client, doctype):
347
346
assert resp .status_code == 200
348
347
349
348
result = resp .data ['results' ][0 ]
350
-
351
349
assert result ['project' ] == project .slug
352
350
assert result ['link' ].endswith ('en/latest/support.html' )
353
351
354
- # Check the main index page.
352
+ @pytest .mark .parametrize ('doctype' , [SPHINX , SPHINX_SINGLEHTML , MKDOCS_HTML ])
353
+ def test_search_correct_link_for_index_page_html_projects (self , api_client , doctype ):
354
+ project = Project .objects .get (slug = 'docs' )
355
+ project .versions .update (documentation_type = doctype )
356
+ version = project .versions .all ().first ()
357
+
355
358
search_params = {
356
359
'project' : project .slug ,
357
360
'version' : version .slug ,
@@ -361,11 +364,15 @@ def test_search_correct_link_html_projects(self, api_client, doctype):
361
364
assert resp .status_code == 200
362
365
363
366
result = resp .data ['results' ][0 ]
364
-
365
367
assert result ['project' ] == project .slug
366
368
assert result ['link' ].endswith ('en/latest/index.html' )
367
369
368
- # Check the index page of a subdirectory.
370
+ @pytest .mark .parametrize ('doctype' , [SPHINX , SPHINX_SINGLEHTML , MKDOCS_HTML ])
371
+ def test_search_correct_link_for_index_page_subdirectory_html_projects (self , api_client , doctype ):
372
+ project = Project .objects .get (slug = 'docs' )
373
+ project .versions .update (documentation_type = doctype )
374
+ version = project .versions .all ().first ()
375
+
369
376
search_params = {
370
377
'project' : project .slug ,
371
378
'version' : version .slug ,
@@ -375,17 +382,15 @@ def test_search_correct_link_html_projects(self, api_client, doctype):
375
382
assert resp .status_code == 200
376
383
377
384
result = resp .data ['results' ][0 ]
378
-
379
385
assert result ['project' ] == project .slug
380
386
assert result ['link' ].endswith ('en/latest/guides/index.html' )
381
387
382
388
@pytest .mark .parametrize ('doctype' , [SPHINX_HTMLDIR , MKDOCS ])
383
- def test_search_correct_link_htmldir_projects (self , api_client , doctype ):
389
+ def test_search_correct_link_for_normal_page_htmldir_projects (self , api_client , doctype ):
384
390
project = Project .objects .get (slug = 'docs' )
385
391
project .versions .update (documentation_type = doctype )
386
392
version = project .versions .all ().first ()
387
393
388
- # Check for a normal page.
389
394
search_params = {
390
395
'project' : project .slug ,
391
396
'version' : version .slug ,
@@ -395,11 +400,15 @@ def test_search_correct_link_htmldir_projects(self, api_client, doctype):
395
400
assert resp .status_code == 200
396
401
397
402
result = resp .data ['results' ][0 ]
398
-
399
403
assert result ['project' ] == project .slug
400
404
assert result ['link' ].endswith ('en/latest/support.html' )
401
405
402
- # Check the main index page.
406
+ @pytest .mark .parametrize ('doctype' , [SPHINX_HTMLDIR , MKDOCS ])
407
+ def test_search_correct_link_for_index_page_htmldir_projects (self , api_client , doctype ):
408
+ project = Project .objects .get (slug = 'docs' )
409
+ project .versions .update (documentation_type = doctype )
410
+ version = project .versions .all ().first ()
411
+
403
412
search_params = {
404
413
'project' : project .slug ,
405
414
'version' : version .slug ,
@@ -409,11 +418,15 @@ def test_search_correct_link_htmldir_projects(self, api_client, doctype):
409
418
assert resp .status_code == 200
410
419
411
420
result = resp .data ['results' ][0 ]
412
-
413
421
assert result ['project' ] == project .slug
414
422
assert result ['link' ].endswith ('en/latest/' )
415
423
416
- # Check the index page of a subdirectory.
424
+ @pytest .mark .parametrize ('doctype' , [SPHINX_HTMLDIR , MKDOCS ])
425
+ def test_search_correct_link_for_index_page_subdirectory_htmldir_projects (self , api_client , doctype ):
426
+ project = Project .objects .get (slug = 'docs' )
427
+ project .versions .update (documentation_type = doctype )
428
+ version = project .versions .all ().first ()
429
+
417
430
search_params = {
418
431
'project' : project .slug ,
419
432
'version' : version .slug ,
@@ -423,7 +436,6 @@ def test_search_correct_link_htmldir_projects(self, api_client, doctype):
423
436
assert resp .status_code == 200
424
437
425
438
result = resp .data ['results' ][0 ]
426
-
427
439
assert result ['project' ] == project .slug
428
440
assert result ['link' ].endswith ('en/latest/guides/' )
429
441
0 commit comments