|
@@ -155,6 +155,42 @@ class TestMeta(object): |
|
|
assert hasattr(p_mc, 'next_by_kind2') |
|
|
assert hasattr(p_mc, 'next_by_kind2') |
|
|
assert not p_mc.next_by_kind2 |
|
|
assert not p_mc.next_by_kind2 |
|
|
|
|
|
|
|
|
|
|
|
def test_prev_next_reversed(self): |
|
|
|
|
|
s = Site(TEST_SITE) |
|
|
|
|
|
cfg = """ |
|
|
|
|
|
plugins: |
|
|
|
|
|
- hyde.ext.sorter.SorterPlugin |
|
|
|
|
|
sorter: |
|
|
|
|
|
folder_name: |
|
|
|
|
|
attr: node.name |
|
|
|
|
|
reverse: True |
|
|
|
|
|
filters: |
|
|
|
|
|
source_file.kind: html |
|
|
|
|
|
""" |
|
|
|
|
|
s.config = Config(TEST_SITE, config_dict=yaml.load(cfg)) |
|
|
|
|
|
s.load() |
|
|
|
|
|
SorterPlugin(s).begin_site() |
|
|
|
|
|
|
|
|
|
|
|
p_404 = s.content.resource_from_relative_path('404.html') |
|
|
|
|
|
p_about = s.content.resource_from_relative_path('about.html') |
|
|
|
|
|
p_mc = s.content.resource_from_relative_path( |
|
|
|
|
|
'blog/2010/december/merry-christmas.html') |
|
|
|
|
|
|
|
|
|
|
|
assert hasattr(p_mc, 'prev_by_folder_name') |
|
|
|
|
|
assert not p_mc.prev_by_folder_name |
|
|
|
|
|
assert hasattr(p_mc, 'next_by_folder_name') |
|
|
|
|
|
assert p_mc.next_by_folder_name == p_404 |
|
|
|
|
|
|
|
|
|
|
|
assert hasattr(p_404, 'prev_by_folder_name') |
|
|
|
|
|
assert p_404.prev_by_folder_name == p_mc |
|
|
|
|
|
assert hasattr(p_404, 'next_by_folder_name') |
|
|
|
|
|
assert p_404.next_by_folder_name == p_about |
|
|
|
|
|
|
|
|
|
|
|
assert hasattr(p_about, 'prev_by_folder_name') |
|
|
|
|
|
assert p_about.prev_by_folder_name == p_404 |
|
|
|
|
|
assert hasattr(p_about, 'next_by_folder_name') |
|
|
|
|
|
assert not p_about.next_by_folder_name |
|
|
|
|
|
|
|
|
def test_walk_resources_sorted_using_generator(self): |
|
|
def test_walk_resources_sorted_using_generator(self): |
|
|
s = Site(TEST_SITE) |
|
|
s = Site(TEST_SITE) |
|
|
cfg = """ |
|
|
cfg = """ |
|
@@ -195,4 +231,3 @@ class TestMeta(object): |
|
|
q = PyQuery(text) |
|
|
q = PyQuery(text) |
|
|
|
|
|
|
|
|
assert q('span.latest').text() == 'YayYayYay' |
|
|
assert q('span.latest').text() == 'YayYayYay' |
|
|
|
|
|
|