[totem-pl-parser] tests: Add content type metadata field for feeds
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem-pl-parser] tests: Add content type metadata field for feeds
- Date: Wed, 3 Mar 2021 14:00:53 +0000 (UTC)
commit 9dbe04c57c676f77751a3254b25a9dde99ed55f1
Author: crvi <crvisqr gmail com>
Date: Wed Mar 3 11:58:53 2021 +0530
tests: Add content type metadata field for feeds
plparse/tests/atom.xml | 27 +++++++++++++++++++++++++++
plparse/tests/feeds.opml | 17 +++++++++++++++++
plparse/tests/parser.c | 26 ++++++++++++++++++++++++--
3 files changed, 68 insertions(+), 2 deletions(-)
---
diff --git a/plparse/tests/atom.xml b/plparse/tests/atom.xml
new file mode 100644
index 0000000..1bfec4b
--- /dev/null
+++ b/plparse/tests/atom.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom">
+ <title>Example Feed</title>
+ <subtitle>A subtitle.</subtitle>
+ <link href="http://example.org/feed/" rel="self" />
+ <link href="http://example.org/" />
+ <id>urn:uuid:60a76c80-d399-11d9-b91C-0003939e0af6</id>
+ <updated>2003-12-13T18:30:02Z</updated>
+ <entry>
+ <title>Atom-Powered Robots Run Amok</title>
+ <link href="http://example.org/2003/12/13/atom03" />
+ <link rel="alternate" type="text/html" href="http://example.org/2003/12/13/atom03.html"/>
+ <link rel="edit" href="http://example.org/2003/12/13/atom03/edit"/>
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+ <updated>2003-12-13T18:30:02Z</updated>
+ <summary>Some text.</summary>
+ <content type="xhtml">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <p>This is the entry content.</p>
+ </div>
+ </content>
+ <author>
+ <name>John Doe</name>
+ <email>johndoe example com</email>
+ </author>
+ </entry>
+</feed>
diff --git a/plparse/tests/feeds.opml b/plparse/tests/feeds.opml
new file mode 100644
index 0000000..ca6e4f9
--- /dev/null
+++ b/plparse/tests/feeds.opml
@@ -0,0 +1,17 @@
+<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
+<opml version="1.0">
+ <head>
+ <title>PodcastAddict registration feeds</title>
+ <dateCreated>Feb 16, 2021 11:27:15 AM</dateCreated>
+ <dateModified>Feb 16, 2021 11:27:15 AM</dateModified>
+ </head>
+ <body>
+ <outline text="Economist Radio" type="rss" xmlUrl="http://rss.acast.com/theeconomistallaudio" htmlUrl=""
/>
+ <outline text="Editor's Picks from The Economist" type="rss"
xmlUrl="http://rss.acast.com/theeconomisteditorspicks" htmlUrl="" />
+ <outline text="Global News Podcast" type="rss" xmlUrl="https://podcasts.files.bbci.co.uk/p02nq0gn.rss"
htmlUrl="" />
+ <outline text="Le Cours de l'histoire" type="rss"
xmlUrl="https://radiofrance-podcast.net/podcast09/35099478-7c72-4f9e-a6de-1b928400e9e5/rss_10076.xml"
htmlUrl="https://www.franceculture.fr/emissions/le-cours-de-lhistoire" />
+ <outline text="The Compass" type="rss" xmlUrl="https://podcasts.files.bbci.co.uk/p035w97h.rss"
htmlUrl="" />
+ <outline text="The Documentary Podcast" type="rss"
xmlUrl="https://podcasts.files.bbci.co.uk/p02nq0lx.rss" htmlUrl="" />
+ <outline text="The Inquiry" type="rss" xmlUrl="https://podcasts.files.bbci.co.uk/p029399x.rss"
htmlUrl="" />
+ </body>
+</opml>
\ No newline at end of file
diff --git a/plparse/tests/parser.c b/plparse/tests/parser.c
index 516998c..500b7fb 100644
--- a/plparse/tests/parser.c
+++ b/plparse/tests/parser.c
@@ -748,7 +748,28 @@ test_parsing_rtsp_text (void)
}
static void
-test_parsing_content_type (void)
+test_parsing_feed_content_type (void)
+{
+ char *uri;
+
+ /* rss */
+ uri = get_relative_uri (TEST_SRCDIR "podcast-description.rss");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_CONTENT_TYPE), ==,
"application/rss+xml");
+ g_free (uri);
+
+ /* atom */
+ uri = get_relative_uri (TEST_SRCDIR "atom.xml");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_CONTENT_TYPE), ==,
"application/atom+xml");
+ g_free (uri);
+
+ /* opml */
+ uri = get_relative_uri (TEST_SRCDIR "feeds.opml");
+ g_assert_cmpstr (parser_test_get_playlist_field (uri, TOTEM_PL_PARSER_FIELD_CONTENT_TYPE), ==,
"text/x-opml+xml");
+ g_free (uri);
+}
+
+static void
+test_parsing_item_content_type (void)
{
char *uri;
@@ -1672,7 +1693,8 @@ main (int argc, char *argv[])
g_test_add_func ("/parser/parsing/xml_comment_whitespace",
test_parsing_xml_comment_whitespace);
g_test_add_func ("/parser/parsing/multi_line_rtsptext", test_parsing_rtsp_text_multi);
g_test_add_func ("/parser/parsing/single_line_rtsptext", test_parsing_rtsp_text);
- g_test_add_func ("/parser/parsing/podcast_content_type", test_parsing_content_type);
+ g_test_add_func ("/parser/parsing/podcast_feed_content_type", test_parsing_feed_content_type);
+ g_test_add_func ("/parser/parsing/podcast_item_content_type", test_parsing_item_content_type);
g_test_add_func ("/parser/parsing/podcast_medium", test_parsing_medium);
g_test_add_func ("/parser/parsing/podcast_feed_description", test_parsing_feed_description);
g_test_add_func ("/parser/parsing/podcast_item_description", test_parsing_item_description);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]