Exemple #1
0
    def test_no_update(self):
        with open(
                "../plugins/feedretriever/test/basic_rss_0-entries.xml") as f:
            data = f.read()
            feed = Feed(data, "No update")

            def say(output):
                self.fail(
                    "Got output even when the feed hasn't been updated: {}".
                    format(output))

            feed.update(data, say)
 def test_title_starting_with_new_line(self):
     with open(
             "../plugins/feedretriever/test/basic_rss_0-entries.xml") as f:
         feed_name = """
         Test feed"""
         feed = Feed(f.read(), feed_name)
         self.assertEqual(feed.title, "Test feed")
Exemple #3
0
    def test_initial_update(self):
        with open(
                "../plugins/feedretriever/test/basic_rss_0-entries.xml") as f1:
            data = f1.read()
            feed_name = "Test"
            feed = Feed(data, feed_name)
            self.updated = False

            def say(output):
                self.assertEqual(
                    output,
                    FeedItemToString("Test Title", "http://www.example.com",
                                     feed_name))
                self.updated = True

            with open("../plugins/feedretriever/test/basic_rss_1-entries.xml"
                      ) as f2:
                data = f2.read()
                feed.update(data, say)
                self.assertTrue(self.updated)
    def test_feed_item_has_new_lines(self):
        with open(
                "../plugins/feedretriever/test/basic_rss_0-entries.xml") as f1:
            data = f1.read()
            feed_name = """
            Test
            feed
            """
            feed = Feed(data, feed_name)
            self.assertEqual(feed.title, "Test feed")
            self.updated = False

            def say(output):
                self.assertEqual(
                    output, "Test feed: Test Title <http://www.example.com>")
                self.updated = True

            with open(
                    "../plugins/feedretriever/test/basic_rss_1-entries_new_line.xml"
            ) as f2:
                data = f2.read()
                feed.update(data, say)
                self.assertTrue(self.updated)
Exemple #5
0
 def test_basic_feed(self):
     with open(
             "../plugins/feedretriever/test/basic_rss_0-entries.xml") as f:
         feed = Feed(f.read(), "Basic Feed")