Beispiel #1
0
def test_feed_validations_two_channels():
    # A feed having 2 root-level tags used to be disallowed, but since some
    # otherwise valid feeds had this, they are now allowed.
    # This test now checks that the first tag is loaded, which has 2 episodes
    # instead of the second tag's single episode.
    myfeed = feed.Feed(file=my_dir + "/feeds/valid_two_channels.xml")
    assert isinstance(myfeed, feed.Feed)
    assert myfeed.validated
    assert len(myfeed.parse_episodes()) == 2
Beispiel #2
0
def test_feed_load_error():
    with pytest.raises(feed.FeedLoadError):
        feed.Feed(file="notreal")
Beispiel #3
0
def test_feed_download_error():
    with pytest.raises(feed.FeedDownloadError):
        feed.Feed(url="http://notreal")
Beispiel #4
0
def test_feed_validation_valid():
    myfeed = feed.Feed(file=my_dir + "/feeds/valid_basic.xml")
    assert isinstance(myfeed, feed.Feed)
    assert myfeed.validated
    assert len(myfeed.parse_episodes()) == 3
Beispiel #5
0
def test_feed_validations_no_channel():
    with pytest.raises(feed.FeedStructureError):
        feed.Feed(file=my_dir + "/feeds/broken_no_channel.xml")
Beispiel #6
0
def test_feed_validations_extra_description():
    with pytest.raises(feed.FeedStructureError):
        feed.Feed(file=my_dir + "/feeds/broken_extra_description.xml")
Beispiel #7
0
def test_feed_validations_item_title():
    with pytest.raises(feed.FeedStructureError):
        feed.Feed(file=my_dir + "/feeds/broken_item_title.xml")
Beispiel #8
0
def test_feed_validations_rss_empty():
    with pytest.raises(feed.FeedStructureError):
        feed.Feed(file=my_dir + "/feeds/broken_rss_empty.xml")
Beispiel #9
0
def test_feed_validation_valid_mixed_enclosure():
    myfeed = feed.Feed(file=my_dir + "/feeds/valid_mixed_enclosures.xml")
    assert isinstance(myfeed, feed.Feed)
    assert myfeed.validated
    assert len(myfeed.parse_episodes()) == 2
Beispiel #10
0
def test_feed_validation_valid():
    myfeed = feed.Feed(file=my_dir + "/feeds/valid_basic.xml")
    assert isinstance(myfeed, feed.Feed)
    assert myfeed.validated
Beispiel #11
0
def test_feed_validations_extra_link():
    with pytest.raises(feed.FeedStructureError):
        myfeed = feed.Feed(file=my_dir + "/feeds/broken_extra_link.xml")
Beispiel #12
0
def test_feed_validations_no_version():
    with pytest.raises(feed.FeedStructureError):
        myfeed = feed.Feed(file=my_dir + "/feeds/broken_no_version.xml")
Beispiel #13
0
def test_feed_validations_two_channels():
    with pytest.raises(feed.FeedStructureError):
        myfeed = feed.Feed(file=my_dir + "/feeds/broken_two_channels.xml")