implement a rudimentary Atom/RSS feed module
this provides a somewhat unconfigurable (at the moment) feed module which provides Atom and RSS feeds. entries are determined by symlinks to content pages, because my core CMS usage is still more general and not blog-like. the symlinks allow for arbitrarily adding entries as I see fit. this also moves core Markdown parser stuff to the library module, since that's used by the feed as well as normal pages Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
This commit is contained in:
1
tests/instance/feed/2023/12/01/forced-no-title.md
Symbolic link
1
tests/instance/feed/2023/12/01/forced-no-title.md
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../pages/forced-no-title.md
|
||||
1
tests/instance/feed/2023/12/30/page.md
Symbolic link
1
tests/instance/feed/2023/12/30/page.md
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../../pages/subdir-with-title/page.md
|
||||
32
tests/test_feed.py
Normal file
32
tests/test_feed.py
Normal file
@@ -0,0 +1,32 @@
|
||||
"""Test the feed methods.
|
||||
|
||||
SPDX-FileCopyrightText: © 2023 Brian S. Stephan <bss@incorporeal.org>
|
||||
SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""
|
||||
from incorporealcms.feed import serve_feed
|
||||
|
||||
|
||||
def test_unknown_type_is_404(client):
|
||||
"""Test that requesting a feed type that doesn't exist is a 404."""
|
||||
response = client.get('/feed/wat')
|
||||
assert response.status_code == 404
|
||||
|
||||
|
||||
def test_atom_type_is_200(client):
|
||||
"""Test that requesting an ATOM feed is found."""
|
||||
response = client.get('/feed/atom')
|
||||
assert response.status_code == 200
|
||||
print(response.text)
|
||||
|
||||
|
||||
def test_rss_type_is_200(client):
|
||||
"""Test that requesting an RSS feed is found."""
|
||||
response = client.get('/feed/rss')
|
||||
assert response.status_code == 200
|
||||
print(response.text)
|
||||
|
||||
|
||||
def test_feed_generator(app):
|
||||
"""Test the root feed generator."""
|
||||
with app.test_request_context():
|
||||
serve_feed('atom')
|
||||
Reference in New Issue
Block a user