@@ -390,3 +390,53 @@ class TestPathVariableServerValid(
390
390
BaseTestVariableValid , BaseTestPathServer ,
391
391
BaseTestSimplePath , BaseTestVariableServer ):
392
392
pass
393
+
394
+
395
+ class TestPathsFindersFind (
396
+ BaseTestSpecServer , BaseTestSimpleServer ):
397
+
398
+ path_name = '/articles/{slug}/comments'
399
+
400
+ @pytest .fixture
401
+ def operation_2 (self ):
402
+ return Operation ('get' , '/articles/{slug}/favorite' , {}, {})
403
+
404
+ @pytest .fixture
405
+ def operations_2 (self , operation_2 ):
406
+ return {
407
+ 'get' : operation_2 ,
408
+ }
409
+
410
+ @pytest .fixture
411
+ def path (self ):
412
+ return Path ('/articles/{slug}/' , {})
413
+
414
+ @pytest .fixture
415
+ def path_2 (self , operations ):
416
+ return Path ('/articles/{slug}/comments' , operations )
417
+
418
+ @pytest .fixture
419
+ def path_3 (self , operations_2 ):
420
+ return Path ('/articles/{slug}/favorite' , operations_2 )
421
+
422
+ @pytest .fixture
423
+ def paths (self , path , path_2 , path_3 ):
424
+ return {
425
+ path .name : path ,
426
+ path_2 .name : path_2 ,
427
+ path_3 .name : path_3 ,
428
+ }
429
+
430
+ def test_paths_order (self , finder , path_2 , operation , server ):
431
+ slug = 'test'
432
+ request_uri = '/articles/{0}/comments' .format (slug )
433
+ request = MockRequest (
434
+ 'http://petstore.swagger.io' , 'get' , request_uri )
435
+
436
+ result = finder .find (request )
437
+
438
+ path_result = TemplateResult (path_2 .name , {'slug' : slug })
439
+ server_result = TemplateResult (self .server_url , {})
440
+ assert result == (
441
+ path_2 , operation , server , path_result , server_result ,
442
+ )
0 commit comments