def test_many_to_many(self): # these two feeds share this entry, we want diffengine to support # multiple feeds for the same content, which is fairly common at # large media organizations with multiple topical feeds url = "https://www.washingtonpost.com/classic-apps/how-a-week-of-tweets-by-trump-stoked-anxiety-moved-markets-and-altered-plans/2017/01/07/38be8e64-d436-11e6-9cb0-54ab630851e8_story.html" f1 = Feed.create( name="feed1", url= "https://raw.githubusercontent.com/DocNow/diffengine/master/test-data/feed1.xml", ) f1.get_latest() f2 = Feed.create( name="feed2", url= "https://raw.githubusercontent.com/DocNow/diffengine/master/test-data/feed2.xml", ) f2.get_latest() assert f1.entries.where(Entry.url == url).count() == 1 assert f2.entries.where(Entry.url == url).count() == 1 e = Entry.get(Entry.url == url) assert FeedEntry.select().where(FeedEntry.entry == e).count() == 2
def setUp(self) -> None: generate_config(test_home, {"db": test_config.get("db", "sqlite:///:memory:")}) # set things up but disable prompting for initial feed init(test_home, prompt=False) self.feed = Feed.create(name="Test", url="https://inkdroid.org/feed.xml") self.feed.get_latest() self.entry = self.feed.entries[0] self.version = self.entry.get_latest()
def test_bad_feed_url(self): # bad feed url shouldn't cause a fatal exception f = Feed.create(name="feed1", url="http://example.org/feedfeed.xml") f.get_latest() assert True
def test_feed(): f = Feed.create(name="Test", url="https://inkdroid.org/feed.xml") f.get_latest() assert f.created assert len(f.entries) == 10