def test_from_urls():
    """Should retrieve feeds and add them to the aggregate"""
    urls = [dummy(), dummy()]
    feeds = [dummy(), dummy()]
    subject = AggregateFeed()
    #
    override(feedparser, 'parse').expects(urls[0]).returns(feeds[0])
    override(subject, 'add_single_feed').expects(feeds[0])
    #
    override(feedparser, 'parse').expects(urls[1]).returns(feeds[1])
    override(subject, 'add_single_feed').expects(feeds[1])
    #
    replay()
    subject.from_urls(urls)
    verify()
def test_from_urls():
    """Should get feeds from URLs and combine them"""
    urls = [Mock(), Mock()]
    feeds = [Mock(), Mock()]
    subject = AggregateFeed()
    aggregate_feed = Mock()
    subject.feedparser = Mock()
    #
    subject.feedparser.expects(once()).parse(same(urls[0])).will(
        return_value(feeds[0]))
    aggregate_feed.expects(once()).\
        add_single_feed(same(aggregate_feed), same(feeds[0]))
    #
    subject.feedparser.expects(once()).parse(same(urls[1])).will(
        return_value(feeds[1]))
    aggregate_feed.expects(once()).\
        add_single_feed(same(aggregate_feed), same(feeds[1]))
    #
    subject.from_urls(aggregate_feed, urls)
    subject.feedparser.verify()
    aggregate_feed.verify()