feedtools 0.2.14 → 0.2.15
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +6 -0
- data/lib/feed_tools.rb +55 -2
- data/lib/feed_tools/feed.rb +17 -16
- data/lib/feed_tools/feed_item.rb +22 -6
- data/rakefile +1 -1
- data/test/amp_test.rb +467 -65
- data/test/atom_test.rb +0 -6
- data/test/cdf_test.rb +0 -12
- data/test/rss_test.rb +21 -90
- metadata +2 -2
data/test/atom_test.rb
CHANGED
@@ -10,29 +10,23 @@ class AtomTest < Test::Unit::TestCase
|
|
10
10
|
feed = FeedTools::Feed.open(
|
11
11
|
'http://feedparser.org/tests/wellformed/atom/atom_namespace_1.xml')
|
12
12
|
assert_equal("Example Atom", feed.title)
|
13
|
-
assert_equal(false, feed.bozo?)
|
14
13
|
feed = FeedTools::Feed.open(
|
15
14
|
'http://feedparser.org/tests/wellformed/atom/atom_namespace_2.xml')
|
16
15
|
assert_equal("Example Atom", feed.title)
|
17
|
-
assert_equal(false, feed.bozo?)
|
18
16
|
feed = FeedTools::Feed.open(
|
19
17
|
'http://feedparser.org/tests/wellformed/atom/atom_namespace_3.xml')
|
20
18
|
assert_equal("Example Atom", feed.title)
|
21
|
-
assert_equal(false, feed.bozo?)
|
22
19
|
feed = FeedTools::Feed.open(
|
23
20
|
'http://feedparser.org/tests/wellformed/atom/atom_namespace_4.xml')
|
24
21
|
assert_equal("Example Atom", feed.title)
|
25
|
-
assert_equal(false, feed.bozo?)
|
26
22
|
feed = FeedTools::Feed.open(
|
27
23
|
'http://feedparser.org/tests/wellformed/atom/atom_namespace_5.xml')
|
28
24
|
assert_equal("Example Atom", feed.title)
|
29
|
-
assert_equal(false, feed.bozo?)
|
30
25
|
end
|
31
26
|
|
32
27
|
def test_feed_author
|
33
28
|
# feed = FeedTools::Feed.open(
|
34
29
|
# 'http://feedparser.org/tests/wellformed/atom/atom_namespace_5.xml')
|
35
30
|
# assert_equal("Example Atom", feed.title)
|
36
|
-
# assert_equal(false, feed.bozo?)
|
37
31
|
end
|
38
32
|
end
|
data/test/cdf_test.rb
CHANGED
@@ -14,11 +14,9 @@ class CdfTest < Test::Unit::TestCase
|
|
14
14
|
</CHANNEL>
|
15
15
|
FEED
|
16
16
|
assert_equal("Example Title", feed.title)
|
17
|
-
assert_equal(false, feed.bozo?)
|
18
17
|
feed = FeedTools::Feed.open(
|
19
18
|
'http://feedparser.org/tests/wellformed/cdf/channel_title.xml')
|
20
19
|
assert_equal("Example feed", feed.title)
|
21
|
-
assert_equal(false, feed.bozo?)
|
22
20
|
end
|
23
21
|
|
24
22
|
def test_feed_description
|
@@ -26,12 +24,10 @@ class CdfTest < Test::Unit::TestCase
|
|
26
24
|
'http://feedparser.org/tests/wellformed/cdf/' +
|
27
25
|
'channel_abstract_map_description.xml')
|
28
26
|
assert_equal("Example description", feed.description)
|
29
|
-
assert_equal(false, feed.bozo?)
|
30
27
|
feed = FeedTools::Feed.open(
|
31
28
|
'http://feedparser.org/tests/wellformed/cdf/' +
|
32
29
|
'channel_abstract_map_tagline.xml')
|
33
30
|
assert_equal("Example description", feed.tagline)
|
34
|
-
assert_equal(false, feed.bozo?)
|
35
31
|
end
|
36
32
|
|
37
33
|
def test_feed_href
|
@@ -41,11 +37,9 @@ class CdfTest < Test::Unit::TestCase
|
|
41
37
|
</CHANNEL>
|
42
38
|
FEED
|
43
39
|
assert_equal("http://www.example.com/", feed.link)
|
44
|
-
assert_equal(false, feed.bozo?)
|
45
40
|
feed = FeedTools::Feed.open(
|
46
41
|
'http://feedparser.org/tests/wellformed/cdf/channel_href_map_link.xml')
|
47
42
|
assert_equal("http://www.example.org/", feed.link)
|
48
|
-
assert_equal(false, feed.bozo?)
|
49
43
|
end
|
50
44
|
|
51
45
|
def test_feed_links
|
@@ -64,14 +58,12 @@ class CdfTest < Test::Unit::TestCase
|
|
64
58
|
assert_equal("icon", feed.images[0].style)
|
65
59
|
assert_equal("http://www.example.com/exampleimage.gif", feed.images[1].url)
|
66
60
|
assert_equal("image", feed.images[1].style)
|
67
|
-
assert_equal(false, feed.bozo?)
|
68
61
|
end
|
69
62
|
|
70
63
|
def test_feed_item_title
|
71
64
|
feed = FeedTools::Feed.open(
|
72
65
|
'http://feedparser.org/tests/wellformed/cdf/item_title.xml')
|
73
66
|
assert_equal("Example item", feed.items.first.title)
|
74
|
-
assert_equal(false, feed.bozo?)
|
75
67
|
end
|
76
68
|
|
77
69
|
def test_feed_item_description
|
@@ -79,19 +71,16 @@ class CdfTest < Test::Unit::TestCase
|
|
79
71
|
'http://feedparser.org/tests/wellformed/cdf/' +
|
80
72
|
'item_abstract_map_description.xml')
|
81
73
|
assert_equal("Example description", feed.items.first.description)
|
82
|
-
assert_equal(false, feed.bozo?)
|
83
74
|
feed = FeedTools::Feed.open(
|
84
75
|
'http://feedparser.org/tests/wellformed/cdf/' +
|
85
76
|
'item_abstract_map_summary.xml')
|
86
77
|
assert_equal("Example description", feed.items.first.summary)
|
87
|
-
assert_equal(false, feed.bozo?)
|
88
78
|
end
|
89
79
|
|
90
80
|
def test_feed_item_href
|
91
81
|
feed = FeedTools::Feed.open(
|
92
82
|
'http://feedparser.org/tests/wellformed/cdf/item_href_map_link.xml')
|
93
83
|
assert_equal("http://www.example.org/", feed.items.first.link)
|
94
|
-
assert_equal(false, feed.bozo?)
|
95
84
|
end
|
96
85
|
|
97
86
|
def test_feed_item_links
|
@@ -116,6 +105,5 @@ class CdfTest < Test::Unit::TestCase
|
|
116
105
|
assert_equal("http://www.example.com/exampleimage.gif",
|
117
106
|
feed.items.first.images[1].url)
|
118
107
|
assert_equal("image", feed.items.first.images[1].style)
|
119
|
-
assert_equal(false, feed.bozo?)
|
120
108
|
end
|
121
109
|
end
|
data/test/rss_test.rb
CHANGED
@@ -9,30 +9,24 @@ class RssTest < Test::Unit::TestCase
|
|
9
9
|
def test_feed_well_formed
|
10
10
|
feed = FeedTools::Feed.open(
|
11
11
|
'http://feedparser.org/tests/wellformed/rss/aaa_wellformed.xml')
|
12
|
-
assert_equal(false, feed.bozo?)
|
13
12
|
end
|
14
13
|
|
15
14
|
def test_feed_title
|
16
15
|
feed = FeedTools::Feed.open(
|
17
16
|
'http://feedparser.org/tests/wellformed/rss/channel_title.xml')
|
18
17
|
assert_equal("Example feed", feed.title)
|
19
|
-
assert_equal(false, feed.bozo?)
|
20
18
|
feed = FeedTools::Feed.open(
|
21
19
|
'http://feedparser.org/tests/wellformed/rss/channel_title_apos.xml')
|
22
20
|
assert_equal("Mark's title", feed.title)
|
23
|
-
assert_equal(false, feed.bozo?)
|
24
21
|
feed = FeedTools::Feed.open(
|
25
22
|
'http://feedparser.org/tests/wellformed/rss/channel_title_gt.xml')
|
26
23
|
assert_equal("2 > 1", feed.title)
|
27
|
-
assert_equal(false, feed.bozo?)
|
28
24
|
feed = FeedTools::Feed.open(
|
29
25
|
'http://feedparser.org/tests/wellformed/rss/channel_title_lt.xml')
|
30
26
|
assert_equal("1 < 2", feed.title)
|
31
|
-
assert_equal(false, feed.bozo?)
|
32
27
|
feed = FeedTools::Feed.open(
|
33
28
|
'http://feedparser.org/tests/wellformed/rss/channel_dc_title.xml')
|
34
29
|
assert_equal("Example title", feed.title)
|
35
|
-
assert_equal(false, feed.bozo?)
|
36
30
|
end
|
37
31
|
|
38
32
|
def test_feed_description
|
@@ -40,56 +34,47 @@ class RssTest < Test::Unit::TestCase
|
|
40
34
|
'http://feedparser.org/tests/wellformed/rss/channel_description.xml')
|
41
35
|
assert_equal(nil, feed.title)
|
42
36
|
assert_equal("Example description", feed.description)
|
43
|
-
assert_equal(false, feed.bozo?)
|
44
37
|
feed = FeedTools::Feed.open(
|
45
38
|
'http://feedparser.org/tests/wellformed/rss/' +
|
46
39
|
'channel_description_escaped_markup.xml')
|
47
40
|
assert_equal("<p>Example description</p>", feed.description)
|
48
|
-
assert_equal(false, feed.bozo?)
|
49
41
|
feed = FeedTools::Feed.open(
|
50
42
|
'http://feedparser.org/tests/wellformed/rss/' +
|
51
43
|
'channel_description_map_tagline.xml')
|
52
44
|
assert_equal("Example description", feed.tagline)
|
53
|
-
assert_equal(false, feed.bozo?)
|
54
45
|
feed = FeedTools::Feed.open(
|
55
46
|
'http://feedparser.org/tests/wellformed/rss/' +
|
56
47
|
'channel_description_naked_markup.xml')
|
57
48
|
assert_equal("<p>Example description</p>", feed.description)
|
58
|
-
assert_equal(false, feed.bozo?)
|
59
49
|
feed = FeedTools::Feed.open(
|
60
50
|
'http://feedparser.org/tests/wellformed/rss/' +
|
61
51
|
'channel_description_shorttag.xml')
|
62
52
|
assert_equal(nil, feed.description)
|
63
53
|
assert_equal('http://example.com/', feed.link)
|
64
|
-
assert_equal(false, feed.bozo?)
|
65
54
|
end
|
66
55
|
|
67
56
|
def test_feed_link
|
68
57
|
feed = FeedTools::Feed.open(
|
69
58
|
'http://feedparser.org/tests/wellformed/rss/channel_link.xml')
|
70
59
|
assert_equal('http://example.com/', feed.link)
|
71
|
-
assert_equal(false, feed.bozo?)
|
72
60
|
end
|
73
61
|
|
74
62
|
def test_feed_generator
|
75
63
|
feed = FeedTools::Feed.open(
|
76
64
|
'http://feedparser.org/tests/wellformed/rss/channel_generator.xml')
|
77
65
|
assert_equal("Example generator", feed.generator)
|
78
|
-
assert_equal(false, feed.bozo?)
|
79
66
|
end
|
80
67
|
|
81
68
|
def test_feed_docs
|
82
69
|
feed = FeedTools::Feed.open(
|
83
70
|
'http://feedparser.org/tests/wellformed/rss/channel_docs.xml')
|
84
71
|
assert_equal("http://www.example.com/", feed.docs)
|
85
|
-
assert_equal(false, feed.bozo?)
|
86
72
|
end
|
87
73
|
|
88
74
|
def test_feed_ttl
|
89
75
|
feed = FeedTools::Feed.open(
|
90
76
|
'http://feedparser.org/tests/wellformed/rss/channel_ttl.xml')
|
91
77
|
assert_equal(1.hour, feed.ttl)
|
92
|
-
assert_equal(false, feed.bozo?)
|
93
78
|
end
|
94
79
|
|
95
80
|
def test_feed_author
|
@@ -99,7 +84,6 @@ class RssTest < Test::Unit::TestCase
|
|
99
84
|
assert_equal("Example editor", feed.author.name)
|
100
85
|
assert_equal("me@example.com", feed.author.email)
|
101
86
|
assert_equal(nil, feed.author.url)
|
102
|
-
assert_equal(false, feed.bozo?)
|
103
87
|
feed = FeedTools::Feed.open(
|
104
88
|
'http://feedparser.org/tests/wellformed/rss/' +
|
105
89
|
'channel_author_map_author_detail_email_2.xml')
|
@@ -107,7 +91,6 @@ class RssTest < Test::Unit::TestCase
|
|
107
91
|
assert_equal("Example editor", feed.author.name)
|
108
92
|
assert_equal("me+spam@example.com", feed.author.email)
|
109
93
|
assert_equal(nil, feed.author.url)
|
110
|
-
assert_equal(false, feed.bozo?)
|
111
94
|
feed = FeedTools::Feed.open(
|
112
95
|
'http://feedparser.org/tests/wellformed/rss/' +
|
113
96
|
'channel_author_map_author_detail_email_3.xml')
|
@@ -115,14 +98,12 @@ class RssTest < Test::Unit::TestCase
|
|
115
98
|
assert_equal("Example editor", feed.author.name)
|
116
99
|
assert_equal("me@example.com", feed.author.email)
|
117
100
|
assert_equal(nil, feed.author.url)
|
118
|
-
assert_equal(false, feed.bozo?)
|
119
101
|
feed = FeedTools::Feed.open(
|
120
102
|
'http://feedparser.org/tests/wellformed/rss/channel_dc_author.xml')
|
121
103
|
assert_equal("Example editor", feed.author.raw)
|
122
104
|
assert_equal("Example editor", feed.author.name)
|
123
105
|
assert_equal(nil, feed.author.email)
|
124
106
|
assert_equal(nil, feed.author.url)
|
125
|
-
assert_equal(false, feed.bozo?)
|
126
107
|
feed = FeedTools::Feed.open(
|
127
108
|
'http://feedparser.org/tests/wellformed/rss/' +
|
128
109
|
'channel_dc_author_map_author_detail_email.xml')
|
@@ -130,14 +111,12 @@ class RssTest < Test::Unit::TestCase
|
|
130
111
|
assert_equal("Example editor", feed.author.name)
|
131
112
|
assert_equal("me@example.com", feed.author.email)
|
132
113
|
assert_equal(nil, feed.author.url)
|
133
|
-
assert_equal(false, feed.bozo?)
|
134
114
|
feed = FeedTools::Feed.open(
|
135
115
|
'http://feedparser.org/tests/wellformed/rss/channel_dc_creator.xml')
|
136
116
|
assert_equal("Example editor", feed.author.raw)
|
137
117
|
assert_equal("Example editor", feed.author.name)
|
138
118
|
assert_equal(nil, feed.author.email)
|
139
119
|
assert_equal(nil, feed.author.url)
|
140
|
-
assert_equal(false, feed.bozo?)
|
141
120
|
feed = FeedTools::Feed.open(
|
142
121
|
'http://feedparser.org/tests/wellformed/rss/' +
|
143
122
|
'channel_dc_creator_map_author_detail_email.xml')
|
@@ -145,14 +124,12 @@ class RssTest < Test::Unit::TestCase
|
|
145
124
|
assert_equal("Example editor", feed.author.name)
|
146
125
|
assert_equal("me@example.com", feed.author.email)
|
147
126
|
assert_equal(nil, feed.author.url)
|
148
|
-
assert_equal(false, feed.bozo?)
|
149
127
|
feed = FeedTools::Feed.open(
|
150
128
|
'http://feedparser.org/tests/wellformed/rss/channel_managingEditor.xml')
|
151
129
|
assert_equal("Example editor", feed.author.raw)
|
152
130
|
assert_equal("Example editor", feed.author.name)
|
153
131
|
assert_equal(nil, feed.author.email)
|
154
132
|
assert_equal(nil, feed.author.url)
|
155
|
-
assert_equal(false, feed.bozo?)
|
156
133
|
feed = FeedTools::Feed.open(
|
157
134
|
'http://feedparser.org/tests/wellformed/rss' +
|
158
135
|
'/channel_managingEditor_map_author_detail_email.xml')
|
@@ -160,7 +137,6 @@ class RssTest < Test::Unit::TestCase
|
|
160
137
|
assert_equal("Example editor", feed.author.name)
|
161
138
|
assert_equal("me@example.com", feed.author.email)
|
162
139
|
assert_equal(nil, feed.author.url)
|
163
|
-
assert_equal(false, feed.bozo?)
|
164
140
|
end
|
165
141
|
|
166
142
|
def test_feed_publisher
|
@@ -170,7 +146,6 @@ class RssTest < Test::Unit::TestCase
|
|
170
146
|
assert_equal("Example editor", feed.publisher.name)
|
171
147
|
assert_equal(nil, feed.publisher.email)
|
172
148
|
assert_equal(nil, feed.publisher.url)
|
173
|
-
assert_equal(false, feed.bozo?)
|
174
149
|
feed = FeedTools::Feed.open(
|
175
150
|
'http://feedparser.org/tests/wellformed/rss/' +
|
176
151
|
'channel_dc_publisher_email.xml')
|
@@ -178,14 +153,12 @@ class RssTest < Test::Unit::TestCase
|
|
178
153
|
assert_equal("Example editor", feed.publisher.name)
|
179
154
|
assert_equal("me@example.com", feed.publisher.email)
|
180
155
|
assert_equal(nil, feed.publisher.url)
|
181
|
-
assert_equal(false, feed.bozo?)
|
182
156
|
feed = FeedTools::Feed.open(
|
183
157
|
'http://feedparser.org/tests/wellformed/rss/channel_webMaster.xml')
|
184
158
|
assert_equal("Example editor", feed.publisher.raw)
|
185
159
|
assert_equal("Example editor", feed.publisher.name)
|
186
160
|
assert_equal(nil, feed.publisher.email)
|
187
161
|
assert_equal(nil, feed.publisher.url)
|
188
|
-
assert_equal(false, feed.bozo?)
|
189
162
|
feed = FeedTools::Feed.open(
|
190
163
|
'http://feedparser.org/tests/wellformed/rss/' +
|
191
164
|
'channel_webMaster_email.xml')
|
@@ -193,7 +166,6 @@ class RssTest < Test::Unit::TestCase
|
|
193
166
|
assert_equal("Example editor", feed.publisher.name)
|
194
167
|
assert_equal("me@example.com", feed.publisher.email)
|
195
168
|
assert_equal(nil, feed.publisher.url)
|
196
|
-
assert_equal(false, feed.bozo?)
|
197
169
|
end
|
198
170
|
|
199
171
|
def test_feed_categories
|
@@ -201,14 +173,12 @@ class RssTest < Test::Unit::TestCase
|
|
201
173
|
'http://feedparser.org/tests/wellformed/rss/channel_category.xml')
|
202
174
|
assert_equal(1, feed.categories.size)
|
203
175
|
assert_equal("Example category", feed.categories.first.value)
|
204
|
-
assert_equal(false, feed.bozo?)
|
205
176
|
feed = FeedTools::Feed.open(
|
206
177
|
'http://feedparser.org/tests/wellformed/rss/' +
|
207
178
|
'channel_category_domain.xml')
|
208
179
|
assert_equal(1, feed.categories.size)
|
209
180
|
assert_equal("Example category", feed.categories.first.value)
|
210
181
|
assert_equal("http://www.example.com/", feed.categories.first.domain)
|
211
|
-
assert_equal(false, feed.bozo?)
|
212
182
|
feed = FeedTools::Feed.open(
|
213
183
|
'http://feedparser.org/tests/wellformed/rss/' +
|
214
184
|
'channel_category_multiple.xml')
|
@@ -217,7 +187,6 @@ class RssTest < Test::Unit::TestCase
|
|
217
187
|
assert_equal("http://www.example.com/1", feed.categories[0].domain)
|
218
188
|
assert_equal("Example category 2", feed.categories[1].value)
|
219
189
|
assert_equal("http://www.example.com/2", feed.categories[1].domain)
|
220
|
-
assert_equal(false, feed.bozo?)
|
221
190
|
feed = FeedTools::Feed.open(
|
222
191
|
'http://feedparser.org/tests/wellformed/rss/' +
|
223
192
|
'channel_category_multiple_2.xml')
|
@@ -226,12 +195,10 @@ class RssTest < Test::Unit::TestCase
|
|
226
195
|
assert_equal(nil, feed.categories[0].domain)
|
227
196
|
assert_equal("Example category 2", feed.categories[1].value)
|
228
197
|
assert_equal(nil, feed.categories[1].domain)
|
229
|
-
assert_equal(false, feed.bozo?)
|
230
198
|
feed = FeedTools::Feed.open(
|
231
199
|
'http://feedparser.org/tests/wellformed/rss/channel_dc_subject.xml')
|
232
200
|
assert_equal(1, feed.categories.size)
|
233
201
|
assert_equal("Example category", feed.categories.first.value)
|
234
|
-
assert_equal(false, feed.bozo?)
|
235
202
|
feed = FeedTools::Feed.open(
|
236
203
|
'http://feedparser.org/tests/wellformed/rss/' +
|
237
204
|
'channel_dc_subject_multiple.xml')
|
@@ -240,18 +207,15 @@ class RssTest < Test::Unit::TestCase
|
|
240
207
|
assert_equal(nil, feed.categories[0].domain)
|
241
208
|
assert_equal("Example category 2", feed.categories[1].value)
|
242
209
|
assert_equal(nil, feed.categories[1].domain)
|
243
|
-
assert_equal(false, feed.bozo?)
|
244
210
|
end
|
245
211
|
|
246
212
|
def test_feed_copyright
|
247
213
|
feed = FeedTools::Feed.open(
|
248
214
|
'http://feedparser.org/tests/wellformed/rss/channel_copyright.xml')
|
249
215
|
assert_equal("Example copyright", feed.copyright)
|
250
|
-
assert_equal(false, feed.bozo?)
|
251
216
|
feed = FeedTools::Feed.open(
|
252
217
|
'http://feedparser.org/tests/wellformed/rss/channel_dc_rights.xml')
|
253
218
|
assert_equal("Example copyright", feed.copyright)
|
254
|
-
assert_equal(false, feed.bozo?)
|
255
219
|
end
|
256
220
|
|
257
221
|
def test_feed_cloud
|
@@ -262,14 +226,12 @@ class RssTest < Test::Unit::TestCase
|
|
262
226
|
assert_equal("/RPC2", feed.cloud.path)
|
263
227
|
assert_equal("myCloud.rssPleaseNotify", feed.cloud.register_procedure)
|
264
228
|
assert_equal("xml-rpc", feed.cloud.protocol)
|
265
|
-
assert_equal(false, feed.bozo?)
|
266
229
|
end
|
267
230
|
|
268
231
|
def test_feed_time_to_live
|
269
232
|
feed = FeedTools::Feed.open(
|
270
233
|
'http://feedparser.org/tests/wellformed/rss/channel_ttl.xml')
|
271
234
|
assert_equal(1.hour, feed.time_to_live)
|
272
|
-
assert_equal(false, feed.bozo?)
|
273
235
|
end
|
274
236
|
|
275
237
|
def test_feed_images
|
@@ -283,7 +245,6 @@ class RssTest < Test::Unit::TestCase
|
|
283
245
|
assert_equal("http://example.org/link", feed.images.first.link)
|
284
246
|
assert_equal(80, feed.images.first.width)
|
285
247
|
assert_equal(15, feed.images.first.height)
|
286
|
-
assert_equal(false, feed.bozo?)
|
287
248
|
end
|
288
249
|
|
289
250
|
def test_feed_text_input
|
@@ -296,7 +257,6 @@ class RssTest < Test::Unit::TestCase
|
|
296
257
|
assert_equal("textInput description", feed.text_input.description)
|
297
258
|
assert_equal(nil, feed.text_input.link)
|
298
259
|
assert_equal(nil, feed.text_input.name)
|
299
|
-
assert_equal(false, feed.bozo?)
|
300
260
|
feed = FeedTools::Feed.open(
|
301
261
|
'http://feedparser.org/tests/wellformed/rss/channel_textInput_link.xml')
|
302
262
|
assert_equal("http://channel.example.com/", feed.link)
|
@@ -304,14 +264,12 @@ class RssTest < Test::Unit::TestCase
|
|
304
264
|
assert_equal(nil, feed.text_input.title)
|
305
265
|
assert_equal(nil, feed.text_input.description)
|
306
266
|
assert_equal(nil, feed.text_input.name)
|
307
|
-
assert_equal(false, feed.bozo?)
|
308
267
|
feed = FeedTools::Feed.open(
|
309
268
|
'http://feedparser.org/tests/wellformed/rss/channel_textInput_name.xml')
|
310
269
|
assert_equal("textinput name", feed.text_input.name)
|
311
270
|
assert_equal(nil, feed.text_input.title)
|
312
271
|
assert_equal(nil, feed.text_input.description)
|
313
272
|
assert_equal(nil, feed.text_input.link)
|
314
|
-
assert_equal(false, feed.bozo?)
|
315
273
|
end
|
316
274
|
|
317
275
|
def test_item_title
|
@@ -319,12 +277,10 @@ class RssTest < Test::Unit::TestCase
|
|
319
277
|
'http://feedparser.org/tests/wellformed/rss/item_title.xml')
|
320
278
|
assert_equal("Item 1 title", feed.items.first.title)
|
321
279
|
assert_equal(nil, feed.items.first.description)
|
322
|
-
assert_equal(false, feed.bozo?)
|
323
280
|
feed = FeedTools::Feed.open(
|
324
281
|
'http://feedparser.org/tests/wellformed/rss/item_dc_title.xml')
|
325
282
|
assert_equal("Example title", feed.items.first.title)
|
326
283
|
assert_equal(nil, feed.items.first.description)
|
327
|
-
assert_equal(false, feed.bozo?)
|
328
284
|
end
|
329
285
|
|
330
286
|
def test_item_description
|
@@ -332,46 +288,38 @@ class RssTest < Test::Unit::TestCase
|
|
332
288
|
'http://feedparser.org/tests/wellformed/rss/item_description.xml')
|
333
289
|
assert_equal('Example description', feed.entries.first.description)
|
334
290
|
assert_equal(nil, feed.entries.first.title)
|
335
|
-
assert_equal(false, feed.bozo?)
|
336
291
|
feed = FeedTools::Feed.open(
|
337
292
|
'http://feedparser.org/tests/wellformed/rss/' +
|
338
293
|
'item_description_escaped_markup.xml')
|
339
294
|
assert_equal('<p>Example description</p>', feed.entries.first.description)
|
340
295
|
assert_equal(nil, feed.entries.first.title)
|
341
|
-
assert_equal(false, feed.bozo?)
|
342
296
|
feed = FeedTools::Feed.open(
|
343
297
|
'http://feedparser.org/tests/wellformed/rss/' +
|
344
298
|
'item_description_map_summary.xml')
|
345
299
|
assert_equal('Example description', feed.entries.first.description)
|
346
300
|
assert_equal(nil, feed.entries.first.title)
|
347
|
-
assert_equal(false, feed.bozo?)
|
348
301
|
feed = FeedTools::Feed.open(
|
349
302
|
'http://feedparser.org/tests/wellformed/rss/' +
|
350
303
|
'item_description_naked_markup.xml')
|
351
304
|
assert_equal('<p>Example description</p>', feed.entries.first.description)
|
352
305
|
assert_equal(nil, feed.entries.first.title)
|
353
|
-
assert_equal(false, feed.bozo?)
|
354
306
|
feed = FeedTools::Feed.open(
|
355
307
|
'http://feedparser.org/tests/wellformed/rss/' +
|
356
308
|
'item_description_not_a_doctype.xml')
|
357
309
|
assert_equal('<!\' <a href="foo">', feed.entries.first.description)
|
358
310
|
assert_equal(nil, feed.entries.first.title)
|
359
|
-
assert_equal(false, feed.bozo?)
|
360
311
|
feed = FeedTools::Feed.open(
|
361
312
|
'http://feedparser.org/tests/wellformed/rss/item_content_encoded.xml')
|
362
313
|
assert_equal('<p>Example content</p>', feed.entries.first.content)
|
363
314
|
assert_equal(nil, feed.entries.first.title)
|
364
|
-
assert_equal(false, feed.bozo?)
|
365
315
|
feed = FeedTools::Feed.open(
|
366
316
|
'http://feedparser.org/tests/wellformed/rss/item_fullitem.xml')
|
367
317
|
assert_equal('<p>Example content</p>', feed.entries.first.content)
|
368
318
|
assert_equal(nil, feed.entries.first.title)
|
369
|
-
assert_equal(false, feed.bozo?)
|
370
319
|
feed = FeedTools::Feed.open(
|
371
320
|
'http://feedparser.org/tests/wellformed/rss/item_xhtml_body.xml')
|
372
321
|
assert_equal('<p>Example content</p>', feed.entries.first.description)
|
373
322
|
assert_equal(nil, feed.entries.first.title)
|
374
|
-
assert_equal(false, feed.bozo?)
|
375
323
|
end
|
376
324
|
|
377
325
|
def test_item_link
|
@@ -380,31 +328,26 @@ class RssTest < Test::Unit::TestCase
|
|
380
328
|
assert_equal('http://example.com/', feed.entries.first.link)
|
381
329
|
assert_equal(nil, feed.entries.first.title)
|
382
330
|
assert_equal(nil, feed.entries.first.description)
|
383
|
-
assert_equal(false, feed.bozo?)
|
384
331
|
end
|
385
332
|
|
386
333
|
def test_item_guid
|
387
334
|
feed = FeedTools::Feed.open(
|
388
335
|
'http://feedparser.org/tests/wellformed/rss/item_guid.xml')
|
389
336
|
assert_equal('http://guid.example.com/', feed.entries.first.guid)
|
390
|
-
assert_equal(false, feed.bozo?)
|
391
337
|
feed = FeedTools::Feed.open(
|
392
338
|
'http://feedparser.org/tests/wellformed/rss/' +
|
393
339
|
'item_guid_conflict_link.xml')
|
394
340
|
assert_equal('http://guid.example.com/', feed.entries.first.guid)
|
395
341
|
assert_equal('http://link.example.com/', feed.entries.first.link)
|
396
|
-
assert_equal(false, feed.bozo?)
|
397
342
|
feed = FeedTools::Feed.open(
|
398
343
|
'http://feedparser.org/tests/wellformed/rss/item_guid_guidislink.xml')
|
399
344
|
assert_equal('http://guid.example.com/', feed.entries.first.guid)
|
400
345
|
assert_equal('http://guid.example.com/', feed.entries.first.link)
|
401
|
-
assert_equal(false, feed.bozo?)
|
402
346
|
feed = FeedTools::Feed.open(
|
403
347
|
'http://feedparser.org/tests/wellformed/rss/' +
|
404
348
|
'item_guid_isPermaLink_map_link.xml')
|
405
349
|
assert_equal('http://guid.example.com/', feed.entries.first.guid)
|
406
350
|
assert_equal('http://guid.example.com/', feed.entries.first.link)
|
407
|
-
assert_equal(false, feed.bozo?)
|
408
351
|
end
|
409
352
|
|
410
353
|
def test_item_author
|
@@ -414,7 +357,6 @@ class RssTest < Test::Unit::TestCase
|
|
414
357
|
assert_equal("Example editor", feed.items.first.author.name)
|
415
358
|
assert_equal(nil, feed.items.first.author.email)
|
416
359
|
assert_equal(nil, feed.items.first.author.url)
|
417
|
-
assert_equal(false, feed.bozo?)
|
418
360
|
feed = FeedTools::Feed.open(
|
419
361
|
'http://feedparser.org/tests/wellformed/rss/' +
|
420
362
|
'item_author_map_author_detail_email.xml')
|
@@ -423,14 +365,12 @@ class RssTest < Test::Unit::TestCase
|
|
423
365
|
assert_equal("Example editor", feed.items.first.author.name)
|
424
366
|
assert_equal("me@example.com", feed.items.first.author.email)
|
425
367
|
assert_equal(nil, feed.items.first.author.url)
|
426
|
-
assert_equal(false, feed.bozo?)
|
427
368
|
feed = FeedTools::Feed.open(
|
428
369
|
'http://feedparser.org/tests/wellformed/rss/item_dc_author.xml')
|
429
370
|
assert_equal("Example editor", feed.items.first.author.raw)
|
430
371
|
assert_equal("Example editor", feed.items.first.author.name)
|
431
372
|
assert_equal(nil, feed.items.first.author.email)
|
432
373
|
assert_equal(nil, feed.items.first.author.url)
|
433
|
-
assert_equal(false, feed.bozo?)
|
434
374
|
feed = FeedTools::Feed.open(
|
435
375
|
'http://feedparser.org/tests/wellformed/rss/' +
|
436
376
|
'item_dc_author_map_author_detail_email.xml')
|
@@ -439,14 +379,12 @@ class RssTest < Test::Unit::TestCase
|
|
439
379
|
assert_equal("Example editor", feed.items.first.author.name)
|
440
380
|
assert_equal("me@example.com", feed.items.first.author.email)
|
441
381
|
assert_equal(nil, feed.items.first.author.url)
|
442
|
-
assert_equal(false, feed.bozo?)
|
443
382
|
feed = FeedTools::Feed.open(
|
444
383
|
'http://feedparser.org/tests/wellformed/rss/item_dc_creator.xml')
|
445
384
|
assert_equal("Example editor", feed.items.first.author.raw)
|
446
385
|
assert_equal("Example editor", feed.items.first.author.name)
|
447
386
|
assert_equal(nil, feed.items.first.author.email)
|
448
387
|
assert_equal(nil, feed.items.first.author.url)
|
449
|
-
assert_equal(false, feed.bozo?)
|
450
388
|
feed = FeedTools::Feed.open(
|
451
389
|
'http://feedparser.org/tests/wellformed/rss/' +
|
452
390
|
'item_dc_creator_map_author_detail_email.xml')
|
@@ -455,7 +393,6 @@ class RssTest < Test::Unit::TestCase
|
|
455
393
|
assert_equal("Example editor", feed.items.first.author.name)
|
456
394
|
assert_equal("me@example.com", feed.items.first.author.email)
|
457
395
|
assert_equal(nil, feed.items.first.author.url)
|
458
|
-
assert_equal(false, feed.bozo?)
|
459
396
|
end
|
460
397
|
|
461
398
|
def test_item_publisher
|
@@ -465,7 +402,6 @@ class RssTest < Test::Unit::TestCase
|
|
465
402
|
assert_equal("Example editor", feed.items.first.publisher.name)
|
466
403
|
assert_equal(nil, feed.items.first.publisher.email)
|
467
404
|
assert_equal(nil, feed.items.first.publisher.url)
|
468
|
-
assert_equal(false, feed.bozo?)
|
469
405
|
feed = FeedTools::Feed.open(
|
470
406
|
'http://feedparser.org/tests/wellformed/rss/' +
|
471
407
|
'item_dc_publisher_email.xml')
|
@@ -473,7 +409,6 @@ class RssTest < Test::Unit::TestCase
|
|
473
409
|
assert_equal("Example editor", feed.items.first.publisher.name)
|
474
410
|
assert_equal("me@example.com", feed.items.first.publisher.email)
|
475
411
|
assert_equal(nil, feed.items.first.publisher.url)
|
476
|
-
assert_equal(false, feed.bozo?)
|
477
412
|
end
|
478
413
|
|
479
414
|
def test_item_categories
|
@@ -481,7 +416,6 @@ class RssTest < Test::Unit::TestCase
|
|
481
416
|
'http://feedparser.org/tests/wellformed/rss/item_category.xml')
|
482
417
|
assert_equal(1, feed.items.first.categories.size)
|
483
418
|
assert_equal("Example category", feed.items.first.categories.first.value)
|
484
|
-
assert_equal(false, feed.bozo?)
|
485
419
|
feed = FeedTools::Feed.open(
|
486
420
|
'http://feedparser.org/tests/wellformed/rss/' +
|
487
421
|
'item_category_domain.xml')
|
@@ -489,7 +423,6 @@ class RssTest < Test::Unit::TestCase
|
|
489
423
|
assert_equal("Example category", feed.items.first.categories.first.value)
|
490
424
|
assert_equal("http://www.example.com/",
|
491
425
|
feed.items.first.categories.first.domain)
|
492
|
-
assert_equal(false, feed.bozo?)
|
493
426
|
feed = FeedTools::Feed.open(
|
494
427
|
'http://feedparser.org/tests/wellformed/rss/' +
|
495
428
|
'item_category_multiple.xml')
|
@@ -502,7 +435,6 @@ class RssTest < Test::Unit::TestCase
|
|
502
435
|
feed.items.first.categories[1].value)
|
503
436
|
assert_equal("http://www.example.com/2",
|
504
437
|
feed.items.first.categories[1].domain)
|
505
|
-
assert_equal(false, feed.bozo?)
|
506
438
|
feed = FeedTools::Feed.open(
|
507
439
|
'http://feedparser.org/tests/wellformed/rss/' +
|
508
440
|
'item_category_multiple_2.xml')
|
@@ -513,12 +445,10 @@ class RssTest < Test::Unit::TestCase
|
|
513
445
|
assert_equal("Example category 2",
|
514
446
|
feed.items.first.categories[1].value)
|
515
447
|
assert_equal(nil, feed.items.first.categories[1].domain)
|
516
|
-
assert_equal(false, feed.bozo?)
|
517
448
|
feed = FeedTools::Feed.open(
|
518
449
|
'http://feedparser.org/tests/wellformed/rss/item_dc_subject.xml')
|
519
450
|
assert_equal(1, feed.items.first.categories.size)
|
520
451
|
assert_equal("Example category", feed.items.first.categories.first.value)
|
521
|
-
assert_equal(false, feed.bozo?)
|
522
452
|
feed = FeedTools::Feed.open(
|
523
453
|
'http://feedparser.org/tests/wellformed/rss/' +
|
524
454
|
'item_dc_subject_multiple.xml')
|
@@ -527,21 +457,18 @@ class RssTest < Test::Unit::TestCase
|
|
527
457
|
assert_equal(nil, feed.items.first.categories[0].domain)
|
528
458
|
assert_equal("Example category 2", feed.items.first.categories[1].value)
|
529
459
|
assert_equal(nil, feed.items.first.categories[1].domain)
|
530
|
-
assert_equal(false, feed.bozo?)
|
531
460
|
end
|
532
461
|
|
533
462
|
def test_item_copyright
|
534
463
|
feed = FeedTools::Feed.open(
|
535
464
|
'http://feedparser.org/tests/wellformed/rss/item_dc_rights.xml')
|
536
465
|
assert_equal("Example copyright", feed.items.first.copyright)
|
537
|
-
assert_equal(false, feed.bozo?)
|
538
466
|
end
|
539
467
|
|
540
468
|
def test_item_comments
|
541
469
|
feed = FeedTools::Feed.open(
|
542
470
|
'http://feedparser.org/tests/wellformed/rss/item_comments.xml')
|
543
471
|
assert_equal("http://example.com/", feed.items.first.comments)
|
544
|
-
assert_equal(false, feed.bozo?)
|
545
472
|
end
|
546
473
|
|
547
474
|
def test_item_enclosures
|
@@ -554,7 +481,6 @@ class RssTest < Test::Unit::TestCase
|
|
554
481
|
assert_equal("image/jpeg", feed.items.first.enclosures[0].type)
|
555
482
|
assert_equal(nil, feed.items.first.title)
|
556
483
|
assert_equal(nil, feed.items.first.description)
|
557
|
-
assert_equal(false, feed.bozo?)
|
558
484
|
feed = FeedTools::Feed.open(
|
559
485
|
'http://feedparser.org/tests/wellformed/rss/' +
|
560
486
|
'item_enclosure_multiple.xml')
|
@@ -569,7 +495,6 @@ class RssTest < Test::Unit::TestCase
|
|
569
495
|
assert_equal("image/gif", feed.items.first.enclosures[1].type)
|
570
496
|
assert_equal(nil, feed.items.first.title)
|
571
497
|
assert_equal(nil, feed.items.first.description)
|
572
|
-
assert_equal(false, feed.bozo?)
|
573
498
|
end
|
574
499
|
|
575
500
|
def test_item_source
|
@@ -577,7 +502,6 @@ class RssTest < Test::Unit::TestCase
|
|
577
502
|
'http://feedparser.org/tests/wellformed/rss/item_source.xml')
|
578
503
|
assert_equal("http://example.com/", feed.items.first.source.url)
|
579
504
|
assert_equal("Example source", feed.items.first.source.value)
|
580
|
-
assert_equal(false, feed.bozo?)
|
581
505
|
end
|
582
506
|
|
583
507
|
# This doesn't *really* test much since FeedTools isn't a namespace
|
@@ -588,71 +512,78 @@ class RssTest < Test::Unit::TestCase
|
|
588
512
|
'http://feedparser.org/tests/wellformed/rss/rss_namespace_1.xml')
|
589
513
|
assert_equal("Example description", feed.description)
|
590
514
|
assert_equal(nil, feed.title)
|
591
|
-
assert_equal(false, feed.bozo?)
|
592
515
|
feed = FeedTools::Feed.open(
|
593
516
|
'http://feedparser.org/tests/wellformed/rss/rss_namespace_2.xml')
|
594
517
|
assert_equal("Example description", feed.description)
|
595
518
|
assert_equal(nil, feed.title)
|
596
|
-
assert_equal(false, feed.bozo?)
|
597
519
|
feed = FeedTools::Feed.open(
|
598
520
|
'http://feedparser.org/tests/wellformed/rss/rss_namespace_3.xml')
|
599
521
|
assert_equal("Example description", feed.description)
|
600
522
|
assert_equal(nil, feed.title)
|
601
|
-
assert_equal(false, feed.bozo?)
|
602
523
|
feed = FeedTools::Feed.open(
|
603
524
|
'http://feedparser.org/tests/wellformed/rss/rss_namespace_4.xml')
|
604
525
|
assert_equal("Example description", feed.description)
|
605
526
|
assert_equal(nil, feed.title)
|
606
|
-
assert_equal(false, feed.bozo?)
|
607
527
|
feed = FeedTools::Feed.open(
|
608
528
|
'http://feedparser.org/tests/wellformed/rss/rss_version_090.xml')
|
609
529
|
assert_equal("rss", feed.feed_type)
|
610
530
|
assert_equal(0.9, feed.feed_version)
|
611
|
-
assert_equal(false, feed.bozo?)
|
612
531
|
feed = FeedTools::Feed.open(
|
613
532
|
'http://feedparser.org/tests/wellformed/rss/rss_version_091_netscape.xml')
|
614
533
|
assert_equal("rss", feed.feed_type)
|
615
534
|
assert_equal(0.91, feed.feed_version)
|
616
|
-
assert_equal(false, feed.bozo?)
|
617
535
|
feed = FeedTools::Feed.open(
|
618
536
|
'http://feedparser.org/tests/wellformed/rss/rss_version_091_userland.xml')
|
619
537
|
assert_equal("rss", feed.feed_type)
|
620
538
|
assert_equal(0.91, feed.feed_version)
|
621
|
-
assert_equal(false, feed.bozo?)
|
622
539
|
feed = FeedTools::Feed.open(
|
623
540
|
'http://feedparser.org/tests/wellformed/rss/rss_version_092.xml')
|
624
541
|
assert_equal("rss", feed.feed_type)
|
625
542
|
assert_equal(0.92, feed.feed_version)
|
626
|
-
assert_equal(false, feed.bozo?)
|
627
543
|
feed = FeedTools::Feed.open(
|
628
544
|
'http://feedparser.org/tests/wellformed/rss/rss_version_093.xml')
|
629
545
|
assert_equal("rss", feed.feed_type)
|
630
546
|
assert_equal(0.93, feed.feed_version)
|
631
|
-
assert_equal(false, feed.bozo?)
|
632
547
|
feed = FeedTools::Feed.open(
|
633
548
|
'http://feedparser.org/tests/wellformed/rss/rss_version_094.xml')
|
634
549
|
assert_equal("rss", feed.feed_type)
|
635
550
|
assert_equal(0.94, feed.feed_version)
|
636
|
-
assert_equal(false, feed.bozo?)
|
637
551
|
feed = FeedTools::Feed.open(
|
638
552
|
'http://feedparser.org/tests/wellformed/rss/rss_version_20.xml')
|
639
553
|
assert_equal("rss", feed.feed_type)
|
640
554
|
assert_equal(2.0, feed.feed_version)
|
641
|
-
assert_equal(false, feed.bozo?)
|
642
555
|
feed = FeedTools::Feed.open(
|
643
556
|
'http://feedparser.org/tests/wellformed/rss/rss_version_201.xml')
|
644
557
|
assert_equal("rss", feed.feed_type)
|
645
558
|
assert_equal(2.0, feed.feed_version)
|
646
|
-
assert_equal(false, feed.bozo?)
|
647
559
|
feed = FeedTools::Feed.open(
|
648
560
|
'http://feedparser.org/tests/wellformed/rss/rss_version_21.xml')
|
649
561
|
assert_equal("rss", feed.feed_type)
|
650
562
|
assert_equal(2.0, feed.feed_version)
|
651
|
-
assert_equal(false, feed.bozo?)
|
652
563
|
feed = FeedTools::Feed.open(
|
653
564
|
'http://feedparser.org/tests/wellformed/rss/rss_version_missing.xml')
|
654
565
|
assert_equal("rss", feed.feed_type)
|
655
566
|
assert_equal(nil, feed.feed_version)
|
656
|
-
|
567
|
+
end
|
568
|
+
|
569
|
+
def test_content_encoded
|
570
|
+
feed = FeedTools::Feed.new
|
571
|
+
feed.feed_data = <<-FEED
|
572
|
+
<rss>
|
573
|
+
<channel>
|
574
|
+
<item>
|
575
|
+
<title>Test Feed Title</title>
|
576
|
+
<content:encoded
|
577
|
+
xmlns:content="http://purl.org/rss/1.0/modules/content/">
|
578
|
+
<![CDATA[
|
579
|
+
Test Feed Content
|
580
|
+
]]>
|
581
|
+
</content:encoded>
|
582
|
+
</item>
|
583
|
+
</channel>
|
584
|
+
</feed>
|
585
|
+
FEED
|
586
|
+
assert_equal("Test Feed Title", feed.items.first.title)
|
587
|
+
assert_equal("Test Feed Content", feed.items.first.content)
|
657
588
|
end
|
658
589
|
end
|