require 'test/unit'
require 'feed_tools'
class NonStandardTest < Test::Unit::TestCase
def setup
FeedTools.tidy_enabled = false
end
def test_xss_strict
feed = FeedTools::Feed.new
feed.xml_data = <<-FEED
tima thinking outloud.
http://www.timaoutloud.org/
The personal weblog of Timothy Appnel
http://www.timaoutloud.org/archives/000415.html
OSCON Wrap-Up.
It's been a week since OSCON ended and I'm just
beginning to recover. This uber post records my notes and
personal views as a speaker and attendee.
http://www.timaoutloud.org/archives/000414.html
Write For The People Who Support You.
Hooray! Mena is back. Ben too. Anil is celebrating
6 years of blogging.
http://www.timaoutloud.org/archives/000413.html
tima@OSCON
Ben Hammersley and I will be presenting 45 syndication hacks
in 45 minutes. Will I be able to keep pace with the madness?
FEED
assert_equal("tima thinking outloud.", feed.title)
assert_equal("http://www.timaoutloud.org/", feed.link)
assert_equal("The personal weblog of Timothy Appnel", feed.description)
assert_equal("OSCON Wrap-Up.", feed.items[0].title)
assert_equal("http://www.timaoutloud.org/archives/000415.html",
feed.items[0].link)
assert_equal(false, feed.items[0].description == nil)
assert_equal("Write For The People Who Support You.", feed.items[1].title)
assert_equal("http://www.timaoutloud.org/archives/000414.html",
feed.items[1].link)
assert_equal(false, feed.items[1].description == nil)
assert_equal("tima@OSCON", feed.items[2].title)
assert_equal("http://www.timaoutloud.org/archives/000413.html",
feed.items[2].link)
assert_equal(false, feed.items[2].description == nil)
end
def test_rss_30_lite
# Delusions of grandeur...
feed = FeedTools::Feed.new
feed.xml_data = <<-FEED
RSS Version 3
http://www.rss3.org/
This is a sample RSS 3 Lite-type feedSun, 14 Aug 2005 09:53:59 +0000http://no.address/enhttp://www.rss3.org/files/r1.icoJonathan Avidan 2005 (c)
editor@rss3.org
webmaster@rss3.org7http://www.rss3.org/rss3lite.htmlRSS 3 Lite First Draft Now Available
http://www.rss3.org/archive/rss3lite/first_draft.html
The RSS 3 Lite-type specification first publicly
available version
Sun, 18 Aug 2005 09:53:59 +0000jonathan@rss3.org6457894357689Welcome to the RSS 3 Official Blog!
http://www.rss3.org/official_blog/?p=2
The RSS 3 Official Blog welcome message
http://www.rss3.org/official_blog/?p=2#comments
Wed, 27 Jul 2005 14:34:51 +0000
jonathan@rss3.org
http://www.rss3.org/official_blog/?p=2
FEED
assert_equal("RSS Version 3", feed.title)
assert_equal("http://www.rss3.org/", feed.link)
assert_equal("This is a sample RSS 3 Lite-type feed", feed.description)
assert_equal("http://no.address/", feed.generator)
assert_equal("en", feed.language)
assert_equal("http://www.rss3.org/files/r1.ico", feed.icon)
assert_equal("Jonathan Avidan 2005 (c)", feed.copyright)
assert_equal(7.day, feed.ttl)
assert_equal("http://www.rss3.org/rss3lite.html", feed.docs)
assert_equal("RSS 3 Lite First Draft Now Available", feed.items[0].title)
assert_equal("http://www.rss3.org/archive/rss3lite/first_draft.html",
feed.items[0].link)
assert_equal(false, feed.items[0].description == nil)
assert_equal(Time.utc(2005, "Aug", 18, 9, 53, 59), feed.items[0].time)
assert_equal("Jonathan Avidan", feed.items[0].author.name)
assert_equal("jonathan@rss3.org", feed.items[0].author.email)
assert_equal("6457894357689", feed.items[0].guid)
assert_equal("Welcome to the RSS 3 Official Blog!", feed.items[1].title)
assert_equal("http://www.rss3.org/official_blog/?p=2", feed.items[1].link)
assert_equal(false, feed.items[1].description == nil)
assert_equal("http://www.rss3.org/official_blog/?p=2#comments",
feed.items[1].comments)
assert_equal(Time.utc(2005, "Jul", 27, 14, 34, 51), feed.items[1].time)
assert_equal("Jonathan Avidan", feed.items[1].author.name)
assert_equal("jonathan@rss3.org", feed.items[1].author.email)
assert_equal("http://www.rss3.org/official_blog/?p=2", feed.items[1].guid)
end
end