slainer68_youtube_it 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/Gemfile +10 -0
  2. data/Gemfile.lock +27 -0
  3. data/Manifest.txt +37 -0
  4. data/README.rdoc +270 -0
  5. data/Rakefile +53 -0
  6. data/VERSION +1 -0
  7. data/lib/youtube_it/chain_io.rb +76 -0
  8. data/lib/youtube_it/client.rb +447 -0
  9. data/lib/youtube_it/middleware/faraday_authheader.rb +24 -0
  10. data/lib/youtube_it/middleware/faraday_oauth.rb +21 -0
  11. data/lib/youtube_it/middleware/faraday_oauth2.rb +13 -0
  12. data/lib/youtube_it/middleware/faraday_youtubeit.rb +30 -0
  13. data/lib/youtube_it/model/activity.rb +17 -0
  14. data/lib/youtube_it/model/author.rb +13 -0
  15. data/lib/youtube_it/model/category.rb +11 -0
  16. data/lib/youtube_it/model/comment.rb +16 -0
  17. data/lib/youtube_it/model/contact.rb +19 -0
  18. data/lib/youtube_it/model/content.rb +18 -0
  19. data/lib/youtube_it/model/message.rb +12 -0
  20. data/lib/youtube_it/model/playlist.rb +11 -0
  21. data/lib/youtube_it/model/rating.rb +23 -0
  22. data/lib/youtube_it/model/subscription.rb +7 -0
  23. data/lib/youtube_it/model/thumbnail.rb +17 -0
  24. data/lib/youtube_it/model/user.rb +27 -0
  25. data/lib/youtube_it/model/video.rb +239 -0
  26. data/lib/youtube_it/parser.rb +534 -0
  27. data/lib/youtube_it/record.rb +12 -0
  28. data/lib/youtube_it/request/base_search.rb +72 -0
  29. data/lib/youtube_it/request/error.rb +15 -0
  30. data/lib/youtube_it/request/standard_search.rb +43 -0
  31. data/lib/youtube_it/request/user_search.rb +47 -0
  32. data/lib/youtube_it/request/video_search.rb +102 -0
  33. data/lib/youtube_it/request/video_upload.rb +538 -0
  34. data/lib/youtube_it/response/video_search.rb +41 -0
  35. data/lib/youtube_it/version.rb +4 -0
  36. data/lib/youtube_it.rb +83 -0
  37. data/slainer68_youtube_it.gemspec +102 -0
  38. data/test/files/recorded_response.xml +1 -0
  39. data/test/files/youtube_video_response.xml +53 -0
  40. data/test/helper.rb +9 -0
  41. data/test/test.mov +0 -0
  42. data/test/test_chain_io.rb +63 -0
  43. data/test/test_client.rb +435 -0
  44. data/test/test_field_search.rb +48 -0
  45. data/test/test_video.rb +48 -0
  46. data/test/test_video_feed_parser.rb +271 -0
  47. data/test/test_video_search.rb +141 -0
  48. metadata +172 -0
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class YouTubeIt
4
+ module Request
5
+ class TestSearch < BaseSearch
6
+ include FieldSearch
7
+
8
+ def initialize(params={})
9
+ @url = fields_to_params(params.delete(:fields))
10
+ end
11
+ end
12
+ end
13
+ end
14
+
15
+ class TestFieldSearch < Test::Unit::TestCase
16
+ include YouTubeIt::Request
17
+
18
+ def default_fields
19
+ "id,updated,openSearch:totalResults,openSearch:startIndex,openSearch:itemsPerPage"
20
+ end
21
+
22
+ def test_should_search_for_range_of_recoreded_on_dates
23
+ starts_at = Date.today - 4
24
+ ends_at = Date.today
25
+ request = TestSearch.new(:fields => {:recorded => (starts_at..ends_at)})
26
+ assert_equal URI.escape("&fields=#{default_fields},entry[xs:date(yt:recorded) > xs:date('#{starts_at.strftime('%Y-%m-%d')}') and xs:date(yt:recorded) < xs:date('#{ends_at.strftime('%Y-%m-%d')}')]"), request.url
27
+ end
28
+
29
+ def test_should_search_for_recoreded_on_date
30
+ recorded_at = Date.today
31
+ request = TestSearch.new(:fields => {:recorded => recorded_at})
32
+ assert_equal URI.escape("&fields=#{default_fields},entry[xs:date(yt:recorded) = xs:date('#{recorded_at.strftime('%Y-%m-%d')}')]"), request.url
33
+ end
34
+
35
+ def test_should_search_for_range_of_published_on_dates
36
+ starts_at = Date.today - 4
37
+ ends_at = Date.today
38
+ request = TestSearch.new(:fields => {:published => (starts_at..ends_at)})
39
+ assert_equal URI.escape("&fields=#{default_fields},entry[xs:dateTime(published) > xs:dateTime('#{starts_at.strftime('%Y-%m-%d')}T00:00:00') and xs:dateTime(published) < xs:dateTime('#{ends_at.strftime('%Y-%m-%d')}T00:00:00')]"), request.url
40
+ end
41
+
42
+ def test_search_for_published_on_date
43
+ published_at = Date.today
44
+ request = TestSearch.new(:fields => {:published => published_at})
45
+ assert_equal URI.escape("&fields=#{default_fields},entry[xs:date(published) = xs:date('#{published_at.strftime('%Y-%m-%d')}')]"), request.url
46
+ end
47
+ end
48
+
@@ -0,0 +1,48 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class TestVideo < Test::Unit::TestCase
4
+ def test_should_extract_unique_id_from_video_id
5
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:ZTUVgYoeN_o")
6
+ assert_equal "ZTUVgYoeN_o", video.unique_id
7
+ end
8
+
9
+ def test_should_extract_unique_id_with_hypen_from_video_id
10
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:BDqs-OZWw9o")
11
+ assert_equal "BDqs-OZWw9o", video.unique_id
12
+ end
13
+
14
+ def test_should_have_related_videos
15
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:BDqs-OZWw9o")
16
+ response = video.related
17
+
18
+ assert_equal "tag:youtube.com,2008:video:BDqs-OZWw9o:related", response.feed_id
19
+ assert_equal 25, response.max_result_count
20
+ assert_equal 23, response.videos.length
21
+ assert_equal 1, response.offset
22
+ assert(response.total_result_count > 0)
23
+ assert_instance_of Time, response.updated_at
24
+ end
25
+
26
+ def test_should_have_response_videos
27
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:BDqs-OZWw9o")
28
+ response = video.responses
29
+
30
+ assert_equal "tag:youtube.com,2008:video:BDqs-OZWw9o:responses", response.feed_id
31
+ assert_equal 25, response.max_result_count
32
+ assert_equal 25, response.videos.length
33
+ assert_equal 1, response.offset
34
+ assert(response.total_result_count > 0)
35
+ assert_instance_of Time, response.updated_at
36
+ end
37
+
38
+ def test_should_scale_video_embed
39
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:EkF4JD2rO3Q", :player_url=>"http://www.youtube.com/v/EkF4JD2rO3Q&feature=youtube_gdata_player", :widescreen => true)
40
+ assert_equal "<object width=\"1280\" height=\"745\">\n<param name=\"movie\" value=\"http://www.youtube.com/v/EkF4JD2rO3Q&feature=youtube_gdata_player\"></param>\n<param name=\"wmode\" value=\"transparent\"></param>\n<embed src=\"http://www.youtube.com/v/EkF4JD2rO3Q&feature=youtube_gdata_player\" type=\"application/x-shockwave-flash\"\nwmode=\"transparent\" width=\"1280\" height=\"745\"></embed>\n</object>\n", video.embed_html_with_width(1280)
41
+ end
42
+
43
+ def test_should_have_iframe_close_tag
44
+ video = YouTubeIt::Model::Video.new(:video_id => "tag:youtube.com,2008:video:EkF4JD2rO3Q")
45
+ assert_equal "<iframe class=\"\" id=\"\" type=\"text/html\" width=\"425\" height=\"350\" src=\"http://www.youtube.com/embed/EkF4JD2rO3Q\" frameborder=\"0\"></iframe>\n", video.embed_html5
46
+ end
47
+ end
48
+
@@ -0,0 +1,271 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class TestVideoFeedParser < Test::Unit::TestCase
4
+
5
+ def test_should_raise_bad_request_exception_when_id_not_found
6
+ bad_url = "http://gdata.youtube.com/feeds/api/videos/abc?v=2"
7
+
8
+ assert_raise(OpenURI::HTTPError) do
9
+ parser = YouTubeIt::Parser::VideoFeedParser.new bad_url
10
+ end
11
+ end
12
+
13
+ # VIDEO ATTRIBUTES AFFECTED BY PARSING
14
+
15
+ def test_should_display_unique_id_correctly_after_parsing
16
+ with_video_response do |parser|
17
+ video = parser.parse
18
+ assert_equal "AbC123DeFgH", video.unique_id
19
+ end
20
+ end
21
+
22
+ # PARSED VIDEO ATTRIBUTES
23
+ def test_should_parse_duration_correctly
24
+ with_video_response do |parser|
25
+ video = parser.parse
26
+ assert_equal 356, video.duration
27
+ end
28
+ end
29
+
30
+ def test_should_parse_widescreen_correctly
31
+ with_video_response do |parser|
32
+ video = parser.parse
33
+ assert_equal true, video.widescreen?
34
+ end
35
+ end
36
+
37
+ def test_should_parse_noembed_correctly
38
+ with_video_response do |parser|
39
+ video = parser.parse
40
+ assert_equal false, video.noembed
41
+ end
42
+ end
43
+
44
+ def test_should_parse_racy_correctly
45
+ with_video_response do |parser|
46
+ video = parser.parse
47
+ assert_equal false, video.racy
48
+ end
49
+ end
50
+
51
+ def test_should_parse_video_id_correctly
52
+ with_video_response do |parser|
53
+ video = parser.parse
54
+ assert_equal "tag:youtube.com,2008:video:AbC123DeFgH", video.video_id
55
+ end
56
+ end
57
+
58
+ def test_should_parse_published_at_correctly
59
+ with_video_response do |parser|
60
+ video = parser.parse
61
+ assert_equal Time.parse("Wed Dec 29 13:57:49 UTC 2010"), video.published_at
62
+ end
63
+ end
64
+
65
+ def test_should_parse_updated_at_correctly
66
+ with_video_response do |parser|
67
+ video = parser.parse
68
+ assert_equal Time.parse("Wed Feb 23 13:54:16 UTC 2011"), video.updated_at
69
+ end
70
+ end
71
+
72
+ def test_should_parse_categories_correctly
73
+ with_video_response do |parser|
74
+ video = parser.parse
75
+ assert_equal "Test", video.categories.first.label
76
+ assert_equal "Test", video.categories.first.term
77
+ end
78
+ end
79
+
80
+ def test_should_parse_keywords_correctly
81
+ with_video_response do |parser|
82
+ video = parser.parse
83
+ assert_equal ["test"], video.keywords
84
+ end
85
+ end
86
+
87
+ def test_should_parse_description_correctly
88
+ with_video_response do |parser|
89
+ video = parser.parse
90
+ assert_equal "Youtube Test Video", video.description
91
+ end
92
+ end
93
+
94
+ def test_should_parse_title_correctly
95
+ with_video_response do |parser|
96
+ video = parser.parse
97
+ assert_equal "YouTube Test Video", video.title
98
+ end
99
+ end
100
+
101
+ def test_should_parse_html_content_correctly
102
+ with_video_response do |parser|
103
+ video = parser.parse
104
+ assert_equal nil, video.html_content
105
+ end
106
+ end
107
+
108
+ def test_should_parse_thumbnails_correctly
109
+ with_video_response do |parser|
110
+ video = parser.parse
111
+ thumbnail = video.thumbnails.first
112
+ assert_equal 90, thumbnail.height
113
+ assert_equal "00:02:58", thumbnail.time
114
+ assert_equal "http://i.ytimg.com/vi/AbC123DeFgH/default.jpg", thumbnail.url
115
+ assert_equal 120, thumbnail.width
116
+ end
117
+ end
118
+
119
+ def test_should_parse_player_url_correctly
120
+ with_video_response do |parser|
121
+ video = parser.parse
122
+ assert_equal "http://www.youtube.com/watch?v=AbC123DeFgH&feature=youtube_gdata_player", video.player_url
123
+ end
124
+ end
125
+
126
+ def test_should_parse_view_count_correctly
127
+ with_video_response do |parser|
128
+ video = parser.parse
129
+ assert_equal 240000, video.view_count
130
+ end
131
+ end
132
+
133
+ def test_should_parse_favorite_count_correctly
134
+ with_video_response do |parser|
135
+ video = parser.parse
136
+ assert_equal 200, video.favorite_count
137
+ end
138
+ end
139
+
140
+ # RATING
141
+
142
+ def test_should_parse_average_correctly
143
+ with_video_response do |parser|
144
+ video = parser.parse
145
+ assert_equal 4.305027, video.rating.average
146
+ end
147
+ end
148
+
149
+ def test_should_parse_max_correctly
150
+ with_video_response do |parser|
151
+ video = parser.parse
152
+ assert_equal 5, video.rating.max
153
+ end
154
+ end
155
+
156
+ def test_should_parse_min_correctly
157
+ with_video_response do |parser|
158
+ video = parser.parse
159
+ assert_equal 1, video.rating.min
160
+ end
161
+ end
162
+
163
+ def test_should_parse_rater_count_correctly
164
+ with_video_response do |parser|
165
+ video = parser.parse
166
+ assert_equal 2049, video.rating.rater_count
167
+ end
168
+ end
169
+
170
+ def test_should_parse_likes_correctly
171
+ with_video_response do |parser|
172
+ video = parser.parse
173
+ assert_equal 1700, video.rating.likes
174
+ end
175
+ end
176
+
177
+ def test_should_parse_dislikes_correctly
178
+ with_video_response do |parser|
179
+ video = parser.parse
180
+ assert_equal 350, video.rating.dislikes
181
+ end
182
+ end
183
+
184
+ # TOD: GEODATA
185
+
186
+ def test_should_parse_where_geodata_correctly
187
+ with_video_response do |parser|
188
+ video = parser.parse
189
+ assert_equal nil, video.where
190
+ end
191
+ end
192
+
193
+ def test_should_parse_position_geodata_correctly
194
+ with_video_response do |parser|
195
+ video = parser.parse
196
+ assert_equal nil, video.position
197
+ end
198
+ end
199
+
200
+ def test_should_parse_latitude_geodata_correctly
201
+ with_video_response do |parser|
202
+ video = parser.parse
203
+ assert_equal nil, video.latitude
204
+ end
205
+ end
206
+
207
+ def test_should_parse_longitude_geodata_correctly
208
+ with_video_response do |parser|
209
+ video = parser.parse
210
+ assert_equal nil, video.longitude
211
+ end
212
+ end
213
+
214
+ # AUTHOR
215
+
216
+ def test_should_parse_author_name_correctly
217
+ with_video_response do |parser|
218
+ video = parser.parse
219
+ assert_equal "Test user", video.author.name
220
+ end
221
+ end
222
+
223
+ def test_should_parse_author_uri_correctly
224
+ with_video_response do |parser|
225
+ video = parser.parse
226
+ assert_equal "http://gdata.youtube.com/feeds/api/users/test_user", video.author.uri
227
+ end
228
+ end
229
+
230
+ # MEDIA CONTENT
231
+
232
+ def test_should_parse_if_media_content_is_default_content_correctly
233
+ with_video_response do |parser|
234
+ video = parser.parse
235
+ content = video.media_content.first
236
+ assert_equal true, content.default
237
+ end
238
+ end
239
+
240
+ def test_should_parse_duration_of_media_contents_correctly
241
+ with_video_response do |parser|
242
+ video = parser.parse
243
+ content = video.media_content.first
244
+ assert_equal 356, content.duration
245
+ end
246
+ end
247
+
248
+ def test_should_parse_mime_type_of_media_content_correctly
249
+ with_video_response do |parser|
250
+ video = parser.parse
251
+ content = video.media_content.first
252
+ assert_equal "application/x-shockwave-flash", content.mime_type
253
+ end
254
+ end
255
+
256
+ def test_should_parse_url_of_media_content_correctly
257
+ with_video_response do |parser|
258
+ video = parser.parse
259
+ content = video.media_content.first
260
+ assert_equal "http://www.youtube.com/v/AbC123DeFgH?f=videos&app=youtube_gdata", content.url
261
+ end
262
+ end
263
+
264
+ def with_video_response &block
265
+ File.open(File.dirname(__FILE__) + '/files/youtube_video_response.xml') do |xml|
266
+ parser = YouTubeIt::Parser::VideoFeedParser.new xml.read
267
+ yield parser
268
+ end
269
+ end
270
+
271
+ end
@@ -0,0 +1,141 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/helper')
2
+
3
+ class TestVideoSearch < Test::Unit::TestCase
4
+
5
+ def test_should_build_basic_query_url
6
+ request = YouTubeIt::Request::VideoSearch.new(:query => "penguin")
7
+ assert_equal "http://gdata.youtube.com/feeds/api/videos?q=penguin&v=2", request.url
8
+ end
9
+
10
+ def test_should_build_multiword_metasearch_query_url
11
+ request = YouTubeIt::Request::VideoSearch.new(:query => 'christina ricci')
12
+ assert_equal "http://gdata.youtube.com/feeds/api/videos?q=christina+ricci&v=2", request.url
13
+ end
14
+
15
+ def test_should_build_video_id_url
16
+ request = YouTubeIt::Request::VideoSearch.new(:video_id => 'T7YazwP8GtY')
17
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/T7YazwP8GtY?v=2", request.url
18
+ end
19
+
20
+ def test_should_build_one_tag_query_url
21
+ request = YouTubeIt::Request::VideoSearch.new(:tags => ['panther'])
22
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/panther/?v=2", request.url
23
+ end
24
+
25
+ def test_should_build_multiple_tags_query_url
26
+ request = YouTubeIt::Request::VideoSearch.new(:tags => ['tiger', 'leopard'])
27
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/tiger/leopard/?v=2", request.url
28
+ end
29
+
30
+ def test_should_build_one_category_query_url
31
+ request = YouTubeIt::Request::VideoSearch.new(:categories => [:news])
32
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News/?v=2", request.url
33
+ end
34
+
35
+ def test_should_build_multiple_categories_query_url
36
+ request = YouTubeIt::Request::VideoSearch.new(:categories => [:news, :sports])
37
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News/Sports/?v=2", request.url
38
+ end
39
+
40
+ def test_should_build_categories_and_tags_query_url
41
+ request = YouTubeIt::Request::VideoSearch.new(:categories => [:news, :sports], :tags => ['soccer', 'football'])
42
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News/Sports/soccer/football/?v=2", request.url
43
+ end
44
+
45
+ def test_should_build_categories_and_tags_url_with_max_results
46
+ request = YouTubeIt::Request::VideoSearch.new(:categories => [:music], :tags => ['classic', 'rock'], :max_results => 2)
47
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/Music/classic/rock/?max-results=2&v=2", request.url
48
+ end
49
+
50
+ def test_should_build_author_query_url
51
+ request = YouTubeIt::Request::VideoSearch.new(:author => "davidguetta")
52
+ assert_equal "http://gdata.youtube.com/feeds/api/videos?author=davidguetta&v=2", request.url
53
+ end
54
+
55
+ def test_should_build_language_query_url
56
+ request = YouTubeIt::Request::VideoSearch.new(:query => 'christina ricci', :lang => 'pt')
57
+ assert_equal "http://gdata.youtube.com/feeds/api/videos?lr=pt&q=christina+ricci&v=2", request.url
58
+ end
59
+
60
+ # -- Standard Feeds --------------------------------------------------------------------------------
61
+
62
+ def test_should_build_url_for_most_viewed
63
+ request = YouTubeIt::Request::StandardSearch.new(:most_viewed)
64
+ assert_equal "http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed?v=2", request.url
65
+ end
66
+
67
+ def test_should_build_url_for_top_rated_for_today
68
+ request = YouTubeIt::Request::StandardSearch.new(:top_rated, :time => :today)
69
+ assert_equal "http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?time=today&v=2", request.url
70
+ end
71
+
72
+ def test_should_build_url_for_most_viewed_offset_and_max_results_without_time
73
+ request = YouTubeIt::Request::StandardSearch.new(:top_rated, :offset => 5, :max_results => 10)
74
+ assert_equal "http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?max-results=10&start-index=5&v=2", request.url
75
+ end
76
+
77
+ def test_should_build_url_for_most_viewed_offset_and_max_results_with_time
78
+ request = YouTubeIt::Request::StandardSearch.new(:top_rated, :offset => 5, :max_results => 10, :time => :today)
79
+ assert_equal "http://gdata.youtube.com/feeds/api/standardfeeds/top_rated?max-results=10&start-index=5&time=today&v=2", request.url
80
+ end
81
+
82
+ def test_should_raise_exception_for_invalid_type
83
+ assert_raise RuntimeError do
84
+ request = YouTubeIt::Request::StandardSearch.new(:most_viewed_yo)
85
+ end
86
+ end
87
+
88
+ # -- Complex Video Queries -------------------------------------------------------------------------
89
+
90
+ def test_should_build_url_for_boolean_or_case_for_categories
91
+ request = YouTubeIt::Request::VideoSearch.new(:categories => { :either => [:news, :sports] })
92
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News%7CSports/?v=2", request.url
93
+ end
94
+
95
+ def test_should_build_url_for_boolean_or_and_exclude_case_for_categories
96
+ request = YouTubeIt::Request::VideoSearch.new(:categories => { :either => [:news, :sports], :exclude => [:comedy] })
97
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News%7CSports/-Comedy/?v=2", request.url
98
+ end
99
+
100
+ def test_should_build_url_for_exclude_case_for_tags
101
+ request = YouTubeIt::Request::VideoSearch.new(:categories => { :either => [:news, :sports], :exclude => [:comedy] },
102
+ :tags => { :include => ['football'], :exclude => ['soccer'] })
103
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News%7CSports/-Comedy/football/-soccer/?v=2", request.url
104
+ end
105
+
106
+ def test_should_build_url_for_either_case_for_tags
107
+ request = YouTubeIt::Request::VideoSearch.new(:categories => { :either => [:news, :sports], :exclude => [:comedy] },
108
+ :tags => { :either => ['soccer', 'football', 'donkey'] })
109
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/News%7CSports/-Comedy/soccer%7Cfootball%7Cdonkey/?v=2", request.url
110
+ end
111
+
112
+ def test_should_build_url_for_query_search_with_categories_excluded
113
+ request = YouTubeIt::Request::VideoSearch.new(:query => 'bench press',
114
+ :categories => { :exclude => [:comedy, :entertainment] },
115
+ :max_results => 10)
116
+ assert_equal "http://gdata.youtube.com/feeds/api/videos/-/-Comedy/-Entertainment/?max-results=10&q=bench+press&v=2", request.url
117
+ end
118
+
119
+ # -- User Queries ---------------------------------------------------------------------------------
120
+
121
+ def test_should_build_url_for_videos_by_user
122
+ request = YouTubeIt::Request::UserSearch.new(:user => 'liz')
123
+ assert_equal "http://gdata.youtube.com/feeds/api/users/liz/uploads?v=2", request.url
124
+ end
125
+
126
+ def test_should_build_url_for_videos_by_user_paginate_and_order
127
+ request = YouTubeIt::Request::UserSearch.new(:user => 'liz', :offset => 20, :max_results => 10, :order_by => 'published')
128
+ assert_equal "http://gdata.youtube.com/feeds/api/users/liz/uploads?max-results=10&orderby=published&start-index=20&v=2", request.url
129
+ end
130
+
131
+ def test_should_build_url_for_favorite_videos_by_user
132
+ request = YouTubeIt::Request::UserSearch.new(:favorites, :user => 'liz')
133
+ assert_equal "http://gdata.youtube.com/feeds/api/users/liz/favorites?v=2", request.url
134
+ end
135
+
136
+ def test_should_build_url_for_favorite_videos_by_user_paginate
137
+ request = YouTubeIt::Request::UserSearch.new(:favorites, :user => 'liz', :offset => 20, :max_results => 10)
138
+ assert_equal "http://gdata.youtube.com/feeds/api/users/liz/favorites?max-results=10&start-index=20&v=2", request.url
139
+ end
140
+
141
+ end