Ejemplo n.º 1
0
def test_opml_loop():
    in_feeds = ["http://www.abc.com/def", "http://www.foo.bar.org/quux", "http://example.org/feed"]
    out_feeds = feeds_in_opml(dump_opml(in_feeds))
    
    assert len(out_feeds) == len(in_feeds)
    for url in in_feeds:
        assert url in out_feeds
Ejemplo n.º 2
0
def test_opml_loop_titles():
    in_feeds = ["http://www.abc.com/def", 
                "http://www.foo.bar.org/quux",
                "http://example.org/feed"]

    feed_titles = {}
    feed_titles[in_feeds[0]] = 'Title 0'
    feed_titles[in_feeds[1]] = 'Title 1'
    # feed_titles[in_feeds[2]] = 'Title 2' NO TITLE

    out_feeds = feeds_in_opml(dump_opml(in_feeds, feed_titles=feed_titles), titles=True)
    
    assert len(out_feeds) == len(in_feeds)
    for url, title in out_feeds:
        assert url in in_feeds
        assert feed_titles.get(url, '') == title
Ejemplo n.º 3
0
    def opml(self, id):
        composite = Composite.get(id, ctx)
        if composite is None:
            abort(404)

        feeds = []
        feed_titles = {}
        for sub_info in composite.subscriptions.itervalues():
            feed_url = sub_info.url
            feeds.append(feed_url)
            title = sub_info.title
            if title:
                feed_titles[feed_url] = title

        opmlize_response()
        return dump_opml(feeds, feed_titles=feed_titles)