changed opml route and added controller test for opml endpoint

This commit is contained in:
robs 2024-12-13 16:59:23 +01:00
parent a1ae215dd4
commit f972081b1b
2 changed files with 15 additions and 1 deletions

View file

@ -53,7 +53,7 @@ defmodule PinchflatWeb.Router do
scope "/", PinchflatWeb do scope "/", PinchflatWeb do
pipe_through :feeds pipe_through :feeds
get "/opml", Podcasts.PodcastController, :opml_feed get "/podcasts/opml", Podcasts.PodcastController, :opml_feed
get "/sources/:uuid/feed", Podcasts.PodcastController, :rss_feed get "/sources/:uuid/feed", Podcasts.PodcastController, :rss_feed
get "/sources/:uuid/feed_image", Podcasts.PodcastController, :feed_image get "/sources/:uuid/feed_image", Podcasts.PodcastController, :feed_image

View file

@ -4,6 +4,20 @@ defmodule PinchflatWeb.PodcastControllerTest do
import Pinchflat.MediaFixtures import Pinchflat.MediaFixtures
import Pinchflat.SourcesFixtures import Pinchflat.SourcesFixtures
describe "opml_feed" do
test "renders the XML document", %{conn: conn} do
source = source_fixture()
conn = get(conn, ~p"/podcasts/opml" <> ".xml")
assert conn.status == 200
assert {"content-type", "application/opml+xml; charset=utf-8"} in conn.resp_headers
assert {"content-disposition", "inline"} in conn.resp_headers
assert conn.resp_body =~ ~s"http://www.example.com/sources/#{source.uuid}/feed.xml"
assert conn.resp_body =~ "text=\"Cool and good internal name!\""
end
end
describe "rss_feed" do describe "rss_feed" do
test "renders the XML document", %{conn: conn} do test "renders the XML document", %{conn: conn} do
source = source_fixture() source = source_fixture()