Example #1
0
    def test_empty_feed(self):
        theme = Theme()
        settings = theme.get_feed_settings("")
        self.assertIn("feed_url", settings)
        self.assertIn("feed_title", settings)

        rv = theme.publish([], **settings)
        self.assertEqual("https://jsonfeed.org/version/1.1", rv.get("version"))
Example #2
0
    def test_publish_multipages(self):
        text = textwrap.dedent("""
        Page One
        ========

        Shot One
        --------

        The text.

        .. fx:: tor.static.img  street.jpg
           :offset: 0
           :duration: 0

        Page Two
        ========

        Shot Two
        --------

        More text.

        .. fx:: turberfield.punchline.media  audio/fly_away.mp3
           :offset: 0
           :duration: 8000
           :loop: 12

        """)
        cfg = Settings.config_parser()
        theme = Theme(cfg)
        pages = list(Build.build_pages(text, theme))
        self.assertEqual(2, len(pages), pages)
        self.assertIsInstance(pages[0], Site.Page)
        self.assertIsInstance(pages[1], Site.Page)

        theme = Theme()
        pages = itertools.chain.from_iterable(
            theme.expand(i, output=pathlib.Path(".")) for i in pages)
        settings = theme.get_feed_settings("all")
        feed = theme.publish(pages, **settings)
        self.assertEqual(2, len(feed["items"]))