Skip to content

Commit 047b62c

Browse files
committed
Paths finder paths order test
1 parent 187b3d6 commit 047b62c

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

tests/unit/templating/test_paths_finders.py

+40
Original file line numberDiff line numberDiff line change
@@ -390,3 +390,43 @@ class TestPathVariableServerValid(
390390
BaseTestVariableValid, BaseTestPathServer,
391391
BaseTestSimplePath, BaseTestVariableServer):
392392
pass
393+
394+
395+
class TestPathsFindersFind(
396+
BaseTestSpecServer, BaseTestSimpleServer):
397+
398+
path_name = '/articles/{slug}/favorite'
399+
400+
@pytest.fixture
401+
def path_1(self, operations):
402+
return Path('/articles/{slug}/', {})
403+
404+
@pytest.fixture
405+
def path_2(self, operations):
406+
return Path('/articles/{slug}/comments', {})
407+
408+
@pytest.fixture
409+
def path_3(self, operations):
410+
return Path('/articles/{slug}/favorite', operations)
411+
412+
@pytest.fixture
413+
def paths(self, path_1, path_2, path_3):
414+
return {
415+
path_1.name: path_1,
416+
path_2.name: path_2,
417+
path_3.name: path_3,
418+
}
419+
420+
def test_paths_order(self, finder, path_3, operation, server):
421+
slug = 'test'
422+
request_uri = '/articles/{0}/favorite'.format(slug)
423+
request = MockRequest(
424+
'http://petstore.swagger.io', 'get', request_uri)
425+
426+
result = finder.find(request)
427+
428+
path_result = TemplateResult(path_3.name, {'slug': slug})
429+
server_result = TemplateResult(self.server_url, {})
430+
assert result == (
431+
path_3, operation, server, path_result, server_result,
432+
)

0 commit comments

Comments
 (0)