Skip to content

Fix test for lektor==3.2 #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions tests/test_lektor_atom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

from lxml import objectify

try:
from urllib.parse import urljoin
except ImportError:
# python 2
from urlparse import urljoin


def test_typical_feed(pad, builder):
failures = builder.build_all()
Expand Down Expand Up @@ -90,21 +96,21 @@ def test_virtual_resolver(pad, builder):
# Pass a virtual source path to url_to().
feed_path = "/typical-blog@atom/feed-one"
url_path = pad.get("typical-blog/post1").url_to(feed_path)
assert url_path == "../../typical-blog/feed.xml"
assert urljoin("typical-blog/post1/", url_path) == "typical-blog/feed.xml"

# Pass the AtomFeedSource instance itself to url_to().
feed_instance = pad.get(feed_path)
assert feed_instance and feed_instance.feed_name == "Feed One"
url_path = pad.get("typical-blog/post1").url_to(feed_instance)
assert url_path == "../../typical-blog/feed.xml"
assert urljoin("typical-blog/post1/", url_path) == "typical-blog/feed.xml"

feed_instance = pad.get("typical-blog2@atom/feed-two")
assert feed_instance and feed_instance.feed_name == "feed-two"

feed_instance = pad.get("custom-blog@atom/feed-three")
assert feed_instance and feed_instance.feed_name == "Feed Three"
url_path = pad.get("custom-blog/post1").url_to(feed_instance)
assert url_path == "../../custom-blog/atom.xml"
assert urljoin("custom-blog/post1/", url_path) == "custom-blog/atom.xml"


def test_dependencies(pad, builder, reporter):
Expand Down