Skip to content

Commit

Permalink
RSS: Fix error when re-creating a feed with a different name
Browse files Browse the repository at this point in the history
Closes GH-1547
  • Loading branch information
progval committed May 12, 2024
1 parent b1ba8ec commit 4898926
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion plugins/RSS/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def assert_feed_does_not_exist(self, name, url=None):
raise callbacks.Error(s)
if url:
feed = self.feeds.get(url)
if feed and feed.name != feed.url:
if feed and feed.name != feed.url and feed.name in self.feed_names:
s = format(_('I already have a feed with that URL named %s.'),
feed.name)
raise callbacks.Error(s)
Expand Down
23 changes: 22 additions & 1 deletion plugins/RSS/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def newf(self):

url = 'http://www.advogato.org/rss/articles.xml'
class RSSTestCase(ChannelPluginTestCase):
plugins = ('RSS','Plugin')
plugins = ('RSS', 'Plugin')

timeout = 1

Expand Down Expand Up @@ -121,6 +121,27 @@ def testRemoveAliasedFeed(self, mock):
self.assertEqual(self.irc.getCallback('RSS').feed_names, {})
self.assertTrue(self.irc.getCallback('RSS').get_feed('http://xkcd.com/rss.xml'))

@mock_urllib
def testChangeUrl(self, mock):
try:
self.assertNotError('rss add xkcd http://xkcd.com/rss.xml')
self.assertNotError('rss remove xkcd')
self.assertNotError('rss add xkcd https://xkcd.com/rss.xml')
self.assertRegexp('help xkcd', 'https://')
finally:
self._feedMsg('rss remove xkcd')

@mock_urllib
def testChangeName(self, mock):
try:
self.assertNotError('rss add xkcd http://xkcd.com/rss.xml')
self.assertNotError('rss remove xkcd')
self.assertNotError('rss add xkcd2 http://xkcd.com/rss.xml')
self.assertRegexp('help xkcd2', 'http://xkcd.com')
finally:
self._feedMsg('rss remove xkcd')
self._feedMsg('rss remove xkcd2')

@mock_urllib
def testInitialAnnounceNewest(self, mock):
mock._data = xkcd_new
Expand Down

0 comments on commit 4898926

Please sign in to comment.