See #170: RSS feeds for channels

This commit is contained in:
Eliot Berriot 2020-01-30 17:28:52 +01:00
parent a04b0b706b
commit 9c22a72ed1
No known key found for this signature in database
GPG key ID: 6B501DFD73514E14
18 changed files with 923 additions and 6 deletions

View file

@ -15,6 +15,7 @@ def test_channel_create(logged_in_api_client):
"description": {"text": "This is my channel", "content_type": "text/markdown"},
"tags": ["hello", "world"],
"content_category": "podcast",
"metadata": {"language": "en", "itunes_category": "Sports"},
}
url = reverse("api:v1:channels-list")
@ -192,3 +193,21 @@ def test_subscriptions_all(factories, logged_in_api_client):
assert response.status_code == 200
assert response.data == {"results": [subscription.uuid], "count": 1}
def test_channel_rss_feed(factories, api_client):
channel = factories["audio.Channel"]()
upload1 = factories["music.Upload"](library=channel.library, playable=True)
upload2 = factories["music.Upload"](library=channel.library, playable=True)
expected = serializers.rss_serialize_channel_full(
channel=channel, uploads=[upload2, upload1]
)
url = reverse("api:v1:channels-rss", kwargs={"uuid": channel.uuid})
response = api_client.get(url)
assert response.status_code == 200
assert response.data == expected
assert response["Content-Type"] == "application/rss+xml"