feedvalidator 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ o:Net::HTTPOK
2
+ @code"200:@http_version"1.1: @socket0:
3
+ @readT:
4
+ @body"y<?xml version="1.0" encoding="UTF-8"?>
5
+ <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
6
+ <env:Body>
7
+ <m:feedvalidationresponse env:encodingStyle="http://www.w3.org/2003/05/soap-encoding" xmlns:m="http://www.w3.org/2005/10/feed-validator">
8
+ <m:uri></m:uri>
9
+ <m:checkedby>http://validator.w3.org/feed/check.cgi</m:checkedby>
10
+ <m:date>2006-04-10T16:15:15.643035</m:date>
11
+ <m:validity>true</m:validity>
12
+ <m:errors>
13
+ <m:errorcount>0</m:errorcount>
14
+ <m:errorlist></m:errorlist>
15
+ </m:errors>
16
+ <m:warnings>
17
+ <m:warningcount>1</m:warningcount>
18
+ <m:warninglist><warning>
19
+ <level>warning</level>
20
+ <type>ContainsRelRef</type>
21
+ <line>226</line>
22
+ <column>128</column>
23
+ <text>description should not contain relative URL references</text>
24
+ <msgcount>23</msgcount>
25
+ <backupcolumn>128</backupcolumn>
26
+ <backupline>226</backupline>
27
+ <element>description</element>
28
+ <parent>item</parent>
29
+ </warning>
30
+ </m:warninglist>
31
+ </m:warnings>
32
+ <m:informations>
33
+ <m:infocount>0</m:infocount>
34
+ <m:infolist></m:infolist>
35
+ </m:informations>
36
+ </m:feedvalidationresponse>
37
+ </env:Body>
38
+ </env:Envelope>
39
+
40
+ :@body_existT: @header{ "content-type"(application/soap+xml; charset=UTF-8" date""Mon, 10 Apr 2006 20:15:06 GMT" server"aApache/2.0.54 (Debian GNU/Linux) mod_python/3.1.3 Python/2.3.5 mod_perl/1.999.21 Perl/v5.8.4"transfer-encoding" chunked
@@ -0,0 +1,48 @@
1
+ #--
2
+ # Copyright (c) 2006 Edgar Gonzalez <edgar@lacaraoscura.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ $:.unshift(File.dirname(__FILE__) + "/../../lib/")
24
+
25
+ require 'test/unit'
26
+ require 'feed_validator/assertions'
27
+
28
+ class FeedValidatorAssertionsTest < Test::Unit::TestCase
29
+
30
+ def test_assert_valid_feed
31
+ # a valid feed
32
+ data = ""
33
+ File.open(File.dirname(__FILE__) + "/../feeds/" + "www.w3.org_news.rss.xml").each { |line|
34
+ data << line
35
+ }
36
+ assert_valid_feed(data)
37
+ end
38
+
39
+ def test_cache
40
+ # testing the cache using an invalid feed with a success response cached
41
+ fragment_feed = ">--invalid feed--<"
42
+ response = File.open File.dirname(__FILE__) + "/../responses/success_with_warnings" do |f| Marshal.load(f) end
43
+ filename = File.join Dir::tmpdir, 'feed.' + MD5.md5(fragment_feed).to_s
44
+ File.open filename, 'w+' do |f| Marshal.dump response, f end
45
+ assert_valid_feed(fragment_feed)
46
+ end
47
+
48
+ end
@@ -0,0 +1,63 @@
1
+ #--
2
+ # Copyright (c) 2006 Edgar Gonzalez <edgar@lacaraoscura.com>
3
+ #
4
+ # Permission is hereby granted, free of charge, to any person obtaining
5
+ # a copy of this software and associated documentation files (the
6
+ # "Software"), to deal in the Software without restriction, including
7
+ # without limitation the rights to use, copy, modify, merge, publish,
8
+ # distribute, sublicense, and/or sell copies of the Software, and to
9
+ # permit persons to whom the Software is furnished to do so, subject to
10
+ # the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be
13
+ # included in all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
+ #++
23
+ $:.unshift(File.dirname(__FILE__) + "/../../lib/")
24
+
25
+ require 'test/unit'
26
+ require 'feed_validator'
27
+
28
+ class FeedValidatorTest < Test::Unit::TestCase
29
+
30
+ def test_validate_url
31
+ v = W3C::FeedValidator.new()
32
+ assert v.validate_url('http://www.w3.org/QA/news.rss')
33
+ if v.valid?
34
+ assert v.errors.size == 0
35
+ else
36
+ assert v.errors.size > 0
37
+ end
38
+ end
39
+
40
+ def test_validate_data
41
+ v = W3C::FeedValidator.new()
42
+
43
+ data = ""
44
+ File.open(File.dirname(__FILE__) + "/../feeds/" + "weblog.rubyonrails.org_rss_2_0_articles.xml").each { |line|
45
+ data << line
46
+ }
47
+ assert v.validate_data(data)
48
+ assert !v.valid?
49
+ assert v.errors.size > 0
50
+ assert v.warnings.size == 0
51
+ assert v.informations.size == 0
52
+
53
+ data = ""
54
+ File.open(File.dirname(__FILE__) + "/../feeds/" + "www.w3.org_news.rss.xml").each { |line|
55
+ data << line
56
+ }
57
+ assert v.validate_data(data)
58
+ assert v.valid?
59
+ assert v.errors.size == 0
60
+ assert v.warnings.size >= 1
61
+ end
62
+
63
+ end
metadata ADDED
@@ -0,0 +1,54 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.8.10
3
+ specification_version: 1
4
+ name: feedvalidator
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.1.0
7
+ date: 2006-04-11
8
+ summary: An interface to the W3C Feed Validation online service
9
+ require_paths:
10
+ - lib
11
+ email: edgar@lacaraoscura.com
12
+ homepage: http://feedvalidator.rubyforge.org
13
+ rubyforge_project: feedvalidator
14
+ description: Implements a simple system for generating UUIDs.
15
+ autorequire: feed_validator
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ -
22
+ - ">"
23
+ - !ruby/object:Gem::Version
24
+ version: 0.0.0
25
+ version:
26
+ platform: ruby
27
+ authors:
28
+ - Edgar Gonzalez
29
+ files:
30
+ - rakefile
31
+ - install.rb
32
+ - README
33
+ - CHANGELOG
34
+ - lib/feed_validator
35
+ - lib/feed_validator.rb
36
+ - lib/feed_validator/assertions.rb
37
+ - test/feeds
38
+ - test/responses
39
+ - test/unit
40
+ - test/feeds/weblog.rubyonrails.org_rss_2_0_articles.xml
41
+ - test/feeds/www.w3.org_news.rss.xml
42
+ - test/responses/success_with_warnings
43
+ - test/unit/feed_validator_assertions_test.rb
44
+ - test/unit/feed_validator_test.rb
45
+ test_files: []
46
+ rdoc_options:
47
+ - "--main"
48
+ - README
49
+ extra_rdoc_files:
50
+ - README
51
+ executables: []
52
+ extensions: []
53
+ requirements: []
54
+ dependencies: []