mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-25 20:29:23 +01:00
RSS: Fix bug in @remove that prevented it from fully deleting aliased feeds.
This commit is contained in:
parent
e96633c1e3
commit
435f8de73a
@ -514,6 +514,17 @@ class RSS(callbacks.Plugin):
|
||||
irc.error(_('That\'s not a valid RSS feed command name.'))
|
||||
return
|
||||
self.remove_feed(feed)
|
||||
|
||||
# If the feed was first created "anonymously", eg. with
|
||||
# `@rss announce add http://example.org/rss`, then as a named feed
|
||||
# with `@rss add example http://example.org/rss`,
|
||||
# `self.get_feed(name)` above gets only one of them; so let's
|
||||
# remove the aliased name or URL from the feed names too,
|
||||
# or we would have a dangling entry here.
|
||||
self.feed_names.pop(name, None)
|
||||
self.feed_names.pop(feed.url, None)
|
||||
assert self.get_feed(name) is None
|
||||
|
||||
irc.replySuccess()
|
||||
remove = wrap(remove, ['feedName'])
|
||||
|
||||
|
@ -100,6 +100,17 @@ class RSSTestCase(ChannelPluginTestCase):
|
||||
finally:
|
||||
self.assertNotError('rss remove xkcd')
|
||||
|
||||
@mock_urllib
|
||||
def testRemoveAliasedFeed(self, mock):
|
||||
try:
|
||||
self.assertNotError('rss announce add http://xkcd.com/rss.xml')
|
||||
self.assertNotError('rss add xkcd http://xkcd.com/rss.xml')
|
||||
finally:
|
||||
self.assertNotError('rss announce remove http://xkcd.com/rss.xml')
|
||||
self.assertNotError('rss remove xkcd')
|
||||
self.assertEqual(self.irc.getCallback('RSS').feed_names, {})
|
||||
self.assertEqual(self.irc.getCallback('RSS').feeds, {})
|
||||
|
||||
@mock_urllib
|
||||
def testInitialAnnounceNewest(self, mock):
|
||||
mock._data = xkcd_new
|
||||
|
Loading…
Reference in New Issue
Block a user