remove resolve_page_file, been refactored away
This commit is contained in:
parent
15c88d920b
commit
dd7687884a
|
@ -125,20 +125,6 @@ def instance_resource_path_to_request_path(path):
|
|||
return re.sub(r'^pages/', '', re.sub(r'.md$', '', re.sub(r'index.md$', '', path)))
|
||||
|
||||
|
||||
def resolve_page_file(path):
|
||||
"""Manipulate the request path to find appropriate page file.
|
||||
|
||||
* convert dir requests to index files
|
||||
|
||||
Worth noting, Flask already does stuff like convert '/foo/../../../bar' to
|
||||
'/bar', so we don't need to take care around file access here.
|
||||
"""
|
||||
if path.endswith('/'):
|
||||
path = f'{path}index'
|
||||
path = f'pages/{path}.md'
|
||||
return path
|
||||
|
||||
|
||||
def generate_parent_navs(path):
|
||||
"""Create a series of paths/links to navigate up from the given resource path."""
|
||||
if path == 'pages/index.md':
|
||||
|
|
|
@ -3,22 +3,7 @@ import pytest
|
|||
from werkzeug.http import dump_cookie
|
||||
|
||||
from incorporealcms.pages import (generate_parent_navs, instance_resource_path_to_request_path, render,
|
||||
request_path_to_instance_resource_path, resolve_page_file)
|
||||
|
||||
|
||||
def test_resolve_page_file_dir_to_index():
|
||||
"""Test that a request to a directory path results in the dir's index.md."""
|
||||
assert resolve_page_file('foo/') == 'pages/foo/index.md'
|
||||
|
||||
|
||||
def test_resolve_page_file_subdir_to_index():
|
||||
"""Test that a request to a dir's subdir path results in the subdir's index.md."""
|
||||
assert resolve_page_file('foo/bar/') == 'pages/foo/bar/index.md'
|
||||
|
||||
|
||||
def test_resolve_page_file_other_requests_fine():
|
||||
"""Test that a request to non-dir path results in a Markdown file."""
|
||||
assert resolve_page_file('foo/baz') == 'pages/foo/baz.md'
|
||||
request_path_to_instance_resource_path)
|
||||
|
||||
|
||||
def test_generate_page_navs_index(app):
|
||||
|
|
Loading…
Reference in New Issue