def test_ignore(): class PermanentlyRedirectedFeed(_BasePermanentlyRedirectedFeed): def pass1(feed): # feed url has *not* changed assert feed.url == u'http://myolddomain.com/feed.xml' feedev.testcustom(COMMON_FEEDS + [PermanentlyRedirectedFeed], addins=[update_redirects(ignore=True)])
def test_force(): class PermanentlyRedirectedFeed(_BasePermanentlyRedirectedFeed): def pass1(feed): # feed url has changed assert feed.url == u'http://new.org/feeds/rss' feedev.testcustom(COMMON_FEEDS + [PermanentlyRedirectedFeed], addins=[update_redirects(force=True)])
def test_delete_other(): class PermanentlyRedirectedFeed(_BasePermanentlyRedirectedFeed): def pass1(feed): # url has changed assert feed.url == u'http://new.org/feeds/rss' # no other feed with that url exists assert db.store.find(models.Feed, models.Feed.url == u'http://new.org/feeds/rss').count() == 1 feedev.testcustom(COMMON_FEEDS + [PermanentlyRedirectedFeed], addins=[update_redirects(delete="other")])
def test_delete_self(): class PermanentlyRedirectedFeed(_BasePermanentlyRedirectedFeed): def pass1(feed): # current feed object does no longer exist assert db.store.find(models.Feed, models.Feed.id == feed.id).count() == 0 # there were two other feeds with the same url that we are # redirecting to, they both still exist (we have only deleted # ourselfs). assert db.store.find(models.Feed, models.Feed.url == u'http://new.org/feeds/rss').count() == 2 feedev.testcustom(COMMON_FEEDS + [PermanentlyRedirectedFeed], addins=[update_redirects(delete="self")])