diff options
author | nextcloud486153 <78801830+nextcloud486153@users.noreply.github.com> | 2022-04-18 11:59:02 +0200 |
---|---|---|
committer | Benjamin Brahmer <info@b-brahmer.de> | 2022-04-18 13:16:01 +0200 |
commit | 032d48ad7b180c80344a8fe64b2f9bfc81cef7b1 (patch) | |
tree | d8b7232194262b5b0fe1f326e99621aa1e36ec33 /tests | |
parent | 78c723f38acc16ac78ba6425ca0acfb2d432baf7 (diff) |
Fix malformed feeds (without GUIDs) stopping the update process (fixes #1738)
Signed-off-by: nextcloud486153 <78801830+nextcloud486153@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Unit/Fetcher/FeedFetcherTest.php | 2 | ||||
-rw-r--r-- | tests/integration/feeds.bats | 11 | ||||
-rw-r--r-- | tests/integration/feeds/no_guid_feed.xml | 78 | ||||
-rw-r--r-- | tests/integration/helpers/settings.bash | 3 |
4 files changed, 92 insertions, 2 deletions
diff --git a/tests/Unit/Fetcher/FeedFetcherTest.php b/tests/Unit/Fetcher/FeedFetcherTest.php index 32b03d3e4..42f518453 100644 --- a/tests/Unit/Fetcher/FeedFetcherTest.php +++ b/tests/Unit/Fetcher/FeedFetcherTest.php @@ -579,7 +579,7 @@ class FeedFetcherTest extends TestCase $this->item_mock->expects($this->exactly(2)) ->method('getTitle') ->will($this->returnValue($this->title)); - $this->item_mock->expects($this->exactly(1)) + $this->item_mock->expects($this->exactly(2)) ->method('getPublicId') ->will($this->returnValue($this->guid)); $this->item_mock->expects($this->exactly(1)) diff --git a/tests/integration/feeds.bats b/tests/integration/feeds.bats index 1e60b5552..5ad52dc30 100644 --- a/tests/integration/feeds.bats +++ b/tests/integration/feeds.bats @@ -22,6 +22,17 @@ teardown() { fi } +@test "[$TESTSUITE] Add feed without GUIDs" { + run ./occ news:feed:add "$user" "$NO_GUID_FEED" + [ "$status" -ne 0 ] + + if ! echo "$output" | grep "No parser can handle this stream"; then + ret_status=$? + echo "Malformed feed exception wasn't properly caught" + return $ret_status + fi +} + @test "[$TESTSUITE] List all" { ./occ news:feed:add "$user" "$NC_FEED" --title "Something-${BATS_SUITE_TEST_NUMBER}" diff --git a/tests/integration/feeds/no_guid_feed.xml b/tests/integration/feeds/no_guid_feed.xml new file mode 100644 index 000000000..e27a1b07b --- /dev/null +++ b/tests/integration/feeds/no_guid_feed.xml @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0">
+ <channel>
+ <generator>RSS Builder by B!Soft</generator>
+ <title>Joshua Wright Dot Net</title>
+ <link>http://www.joshuawright.net</link>
+ <description>This is a feed of the latest comic masterpiece from joshuawright.net</description>
+ <language>en</language>
+ <managingEditor>joshua.wright@live.com.au (Josh Wright)</managingEditor>
+ <webMaster>joshua.wright@live.com.au (Josh Wright)</webMaster>
+ <copyright>2016 JoshuaWright</copyright>
+ <item>
+ <title>Slack Wyrm 911 - Feeling better</title>
+ <pubDate>Wed, 13 Apr 2022 09:07:01 +0100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-911.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 910 - Cake trip</title>
+ <pubDate>Mon, 11 Apr 2022 08:52:54 +0100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-910.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 909 - Cake time</title>
+ <pubDate>Fri, 8 Apr 2022 09:29:32 +0100</pubDate>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 908 - Dragons Lair</title>
+ <pubDate>Wed, 6 Apr 2022 09:00:13 +0100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-908.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 907 - Ten feet tall</title>
+ <pubDate>Mon, 4 Apr 2022 15:12:51 +0100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-907.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 906 - True self</title>
+ <pubDate>Fri, 1 Apr 2022 09:28:06 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-906.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 905 - Drink up</title>
+ <pubDate>Wed, 30 Mar 2022 11:07:49 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-905.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 904 - Marvellous medicine</title>
+ <pubDate>Mon, 28 Mar 2022 09:02:44 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-904.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 903 - Golden still</title>
+ <pubDate>Fri, 25 Mar 2022 09:48:06 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-903.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 902 - Janet the genius</title>
+ <pubDate>Wed, 23 Mar 2022 09:30:47 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-902.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ <item>
+ <title>Slack Wyrm 901 - Bye bye Bucky</title>
+ <pubDate>Mon, 21 Mar 2022 09:01:36 +1100</pubDate>
+ <link>https://joshuawright.net/slack-wyrm-901.html</link>
+ <description><![CDATA[]]></description>
+ </item>
+ </channel>
+</rss>
\ No newline at end of file diff --git a/tests/integration/helpers/settings.bash b/tests/integration/helpers/settings.bash index 4e758b609..bf58a601a 100644 --- a/tests/integration/helpers/settings.bash +++ b/tests/integration/helpers/settings.bash @@ -1,3 +1,4 @@ user=admin NC_FEED="https://nextcloud.com/blog/static-feed/" -HEISE_FEED="https://www.heise.de/rss/heise-atom.xml"
\ No newline at end of file +HEISE_FEED="https://www.heise.de/rss/heise-atom.xml" +NO_GUID_FEED="https://raw.githubusercontent.com/nextcloud/news/master/tests/integration/feeds/no_guid_feed.xml" |