From f972081b1b2a23573de85101a3deb8f367189649 Mon Sep 17 00:00:00 2001 From: robs Date: Fri, 13 Dec 2024 16:59:23 +0100 Subject: [PATCH] changed opml route and added controller test for opml endpoint --- lib/pinchflat_web/router.ex | 2 +- .../controllers/podcast_controller_test.exs | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/lib/pinchflat_web/router.ex b/lib/pinchflat_web/router.ex index e9fb6f3..afcbe24 100644 --- a/lib/pinchflat_web/router.ex +++ b/lib/pinchflat_web/router.ex @@ -53,7 +53,7 @@ defmodule PinchflatWeb.Router do scope "/", PinchflatWeb do 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_image", Podcasts.PodcastController, :feed_image diff --git a/test/pinchflat_web/controllers/podcast_controller_test.exs b/test/pinchflat_web/controllers/podcast_controller_test.exs index 676ab54..ec79b76 100644 --- a/test/pinchflat_web/controllers/podcast_controller_test.exs +++ b/test/pinchflat_web/controllers/podcast_controller_test.exs @@ -4,6 +4,20 @@ defmodule PinchflatWeb.PodcastControllerTest do import Pinchflat.MediaFixtures 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 test "renders the XML document", %{conn: conn} do source = source_fixture()