Skip to content
Snippets Groups Projects
Commit 5ed71dfd authored by James Vasile's avatar James Vasile
Browse files

Add rss feed test

parent 81f7a1f3
No related branches found
No related tags found
No related merge requests found
......@@ -2,3 +2,4 @@ pytest
psutil
bs4
pytest-xprocess
feedparser
from bs4 import BeautifulSoup as Soup
import os
import subprocess
import sys
import pytest
import psutil
import requests
# Import feedparser, but ignore its deprecation warning. Feedparser depends on
# cgi, which will be removed in Python 3.13. The feedparser project is aware of
# the issue (see https://github.com/kurtmckee/feedparser/issues/330) and will
# address it, so we can probably ignore it for now.
import warnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
import feedparser
# Read common test config
sys.path.append(os.curdir)
from .conftest import *
import website
from website import pelicanconf
def test_rss_feed_available(pelican_server):
"""Test that our RSS feed lives where the old one lived and that you can
download it with and without the trailing slash."""
# Don't run our feed tests if feeds aren't enabled
if not pelicanconf.FEEDS_ENABLED:
return
feed_file = os.path.join(OUTPUT_PATH, "feed")
assert os.path.exists(feed_file)
raw_feed_with_slash = fetch("feed/")
print(raw_feed_with_slash)
feed = feedparser.parse(raw_feed_with_slash)
assert feed.bozo == 0
assert feed.feed.title == pelicanconf.SITENAME
assert feed.feed.description == pelicanconf.SITESUBTITLE
feed_with_slash = feed
raw_feed_no_slash = fetch("feed")
print(raw_feed_no_slash)
assert raw_feed_no_slash == raw_feed_with_slash
feed = feedparser.parse(raw_feed_no_slash)
assert feed.bozo == 0
assert feed.feed.title == pelicanconf.SITENAME
assert feed.feed.description == pelicanconf.SITESUBTITLE
# what is feed.feed.link supposed to be? Should we test it for something?
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment