* Added OPML Endpoint for podcast rss feeds * changed opml route and added controller test for opml endpoint * add copy opml feed button * add copy opml feed button - correct url * fix html indenting * add indentation to opml Co-authored-by: Kieran <kieran.eglin@gmail.com> * use convention for unused controller params Co-authored-by: Kieran <kieran.eglin@gmail.com> * add test for opml_sources helper function * change opml endpoint to be more inline with the other routes --------- Co-authored-by: robs <git@robs.social> Co-authored-by: Kieran <kieran.eglin@gmail.com>
35 lines
933 B
Elixir
35 lines
933 B
Elixir
defmodule Pinchflat.Podcasts.OpmlFeedBuilderTest do
|
|
use Pinchflat.DataCase
|
|
|
|
import Pinchflat.SourcesFixtures
|
|
|
|
alias Pinchflat.Podcasts.OpmlFeedBuilder
|
|
|
|
setup do
|
|
source = source_fixture()
|
|
|
|
{:ok, source: source}
|
|
end
|
|
|
|
describe "build/2" do
|
|
test "returns an XML document", %{source: source} do
|
|
res = OpmlFeedBuilder.build("http://example.com", [source])
|
|
|
|
assert String.contains?(res, ~s(<?xml version="1.0" encoding="UTF-8"?>))
|
|
end
|
|
|
|
test "escapes illegal characters" do
|
|
source = source_fixture(%{custom_name: "A & B"})
|
|
res = OpmlFeedBuilder.build("http://example.com", [source])
|
|
|
|
assert String.contains?(res, ~s(A & B))
|
|
end
|
|
|
|
test "build podcast link with URL base", %{source: source} do
|
|
res = OpmlFeedBuilder.build("http://example.com", [source])
|
|
|
|
assert String.contains?(res, ~s(http://example.com/sources/#{source.uuid}/feed.xml))
|
|
end
|
|
end
|
|
end
|