@@ -390,3 +390,48 @@ class TestPathVariableServerValid(
390
390
BaseTestVariableValid , BaseTestPathServer ,
391
391
BaseTestSimplePath , BaseTestVariableServer ):
392
392
pass
393
+
394
+
395
+ class TestSimilarPaths (
396
+ BaseTestSpecServer , BaseTestSimpleServer ):
397
+
398
+ path_name = '/tokens'
399
+
400
+ @pytest .fixture
401
+ def operation_2 (self ):
402
+ return Operation ('get' , '/keys/{id}/tokens' , {}, {})
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 , operations ):
412
+ return Path ('/tokens' , operations )
413
+
414
+ @pytest .fixture
415
+ def path_2 (self , operations_2 ):
416
+ return Path ('/keys/{id}/tokens' , operations_2 )
417
+
418
+ @pytest .fixture
419
+ def paths (self , path , path_2 ):
420
+ return {
421
+ path .name : path ,
422
+ path_2 .name : path_2 ,
423
+ }
424
+
425
+ def test_valid (self , finder , path_2 , operation_2 , server ):
426
+ token_id = '123'
427
+ request_uri = '/keys/{0}/tokens' .format (token_id )
428
+ request = MockRequest (
429
+ 'http://petstore.swagger.io' , 'get' , request_uri )
430
+
431
+ result = finder .find (request )
432
+
433
+ path_result = TemplateResult (path_2 .name , {'id' : token_id })
434
+ server_result = TemplateResult (self .server_url , {})
435
+ assert result == (
436
+ path_2 , operation_2 , server , path_result , server_result ,
437
+ )
0 commit comments