Skip to content

Commit 739c286

Browse files
committed
Paths finder paths order test 2
1 parent 187b3d6 commit 739c286

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/unit/templating/test_paths_finders.py

+45
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,48 @@ class TestPathVariableServerValid(
390390
BaseTestVariableValid, BaseTestPathServer,
391391
BaseTestSimplePath, BaseTestVariableServer):
392392
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, 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, server, path_result, server_result,
437+
)

0 commit comments

Comments
 (0)