mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-02-10 11:34:08 +01:00
RSS: Fix error when re-creating a feed with a different name
Closes GH-1547
This commit is contained in:
parent
b1ba8ecb2a
commit
4898926f20
@ -280,7 +280,7 @@ class RSS(callbacks.Plugin):
|
||||
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)
|
||||
|
@ -84,7 +84,7 @@ def mock_urllib(f):
|
||||
|
||||
url = 'http://www.advogato.org/rss/articles.xml'
|
||||
class RSSTestCase(ChannelPluginTestCase):
|
||||
plugins = ('RSS','Plugin')
|
||||
plugins = ('RSS', 'Plugin')
|
||||
|
||||
timeout = 1
|
||||
|
||||
@ -121,6 +121,27 @@ class RSSTestCase(ChannelPluginTestCase):
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user