flickrie 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. data/.gitignore +0 -1
  2. data/CHANGELOG.md +10 -0
  3. data/Gemfile +3 -2
  4. data/Rakefile +7 -2
  5. data/flickrie.gemspec +3 -0
  6. data/lib/flickrie/api_methods.rb +5 -0
  7. data/lib/flickrie/client.rb +17 -4
  8. data/lib/flickrie/location.rb +23 -50
  9. data/lib/flickrie/media/exif.rb +4 -0
  10. data/lib/flickrie/media/tag.rb +4 -0
  11. data/lib/flickrie/media/ticket.rb +4 -0
  12. data/lib/flickrie/media/visibility.rb +10 -6
  13. data/lib/flickrie/media.rb +7 -70
  14. data/lib/flickrie/media_count.rb +4 -0
  15. data/lib/flickrie/oauth.rb +5 -3
  16. data/lib/flickrie/set.rb +5 -21
  17. data/lib/flickrie/upload_client.rb +4 -2
  18. data/lib/flickrie/user.rb +4 -1
  19. data/lib/flickrie/version.rb +1 -1
  20. data/lib/flickrie/video.rb +0 -13
  21. data/test/error_test.rb +20 -0
  22. data/test/instance_test.rb +13 -14
  23. data/test/license_test.rb +7 -13
  24. data/test/location_test.rb +11 -2
  25. data/test/media_count_test.rb +20 -12
  26. data/test/media_test.rb +319 -311
  27. data/test/oauth_test.rb +17 -18
  28. data/test/photo_test.rb +78 -60
  29. data/test/set_test.rb +72 -63
  30. data/test/{test.rb → test_helper.rb} +7 -0
  31. data/test/user_test.rb +43 -34
  32. data/test/vcr_cassettes/error/code.yml +1165 -0
  33. data/test/vcr_cassettes/instance/calling_api_methods.yml +182 -0
  34. data/test/vcr_cassettes/license/get_licenses.yml +73 -0
  35. data/test/vcr_cassettes/location/square_brackets.yml +85 -0
  36. data/test/vcr_cassettes/media/delete.yml +1380 -0
  37. data/test/vcr_cassettes/media/from_contacts.yml +155 -0
  38. data/test/vcr_cassettes/media/from_set.yml +276 -0
  39. data/test/vcr_cassettes/media/from_user.yml +275 -0
  40. data/test/vcr_cassettes/media/get_context.yml +73 -0
  41. data/test/vcr_cassettes/media/get_info.yml +167 -0
  42. data/test/vcr_cassettes/media/remove_tag.yml +264 -0
  43. data/test/vcr_cassettes/media/replace.yml +2252 -0
  44. data/test/vcr_cassettes/media/search.yml +275 -0
  45. data/test/vcr_cassettes/media/tags.yml +346 -0
  46. data/test/vcr_cassettes/media_count/get.yml +135 -0
  47. data/test/vcr_cassettes/media_count/square_brackets.yml +69 -0
  48. data/test/vcr_cassettes/oauth/tokens.yml +400 -0
  49. data/test/vcr_cassettes/photo/asynchronous_upload.yml +1693 -0
  50. data/test/vcr_cassettes/photo/from_set.yml +273 -0
  51. data/test/vcr_cassettes/photo/from_user.yml +275 -0
  52. data/test/vcr_cassettes/photo/get_exif.yml +239 -0
  53. data/test/vcr_cassettes/photo/get_sizes.yml +147 -0
  54. data/test/vcr_cassettes/photo/other_api_calls.yml +506 -0
  55. data/test/vcr_cassettes/photo/search.yml +271 -0
  56. data/test/vcr_cassettes/photo/square_brackets.yml +85 -0
  57. data/test/vcr_cassettes/photo/upload.yml +1229 -0
  58. data/test/vcr_cassettes/set/from_user.yml +477 -0
  59. data/test/vcr_cassettes/set/get_info.yml +951 -0
  60. data/test/vcr_cassettes/set/square_brackets.yml +73 -0
  61. data/test/vcr_cassettes/user/find_by_email_or_username.yml +135 -0
  62. data/test/vcr_cassettes/user/get_info.yml +151 -0
  63. data/test/vcr_cassettes/user/square_brackets.yml +77 -0
  64. data/test/vcr_cassettes/video/get_exif.yml +135 -0
  65. data/test/vcr_cassettes/video/get_info.yml +86 -0
  66. data/test/vcr_cassettes/video/get_sizes.yml +151 -0
  67. data/test/vcr_cassettes/video/other_api_calls.yml +643 -0
  68. data/test/vcr_cassettes/video/square_brackets.yml +86 -0
  69. data/test/vcr_cassettes/video/upload.yml +308 -0
  70. data/test/video_test.rb +66 -53
  71. metadata +123 -12
data/test/oauth_test.rb CHANGED
@@ -1,26 +1,25 @@
1
- require 'test/unit'
2
- require 'flickrie'
3
-
4
1
  class OAuthTest < Test::Unit::TestCase
5
- def test_raising_errors
6
- Flickrie.api_key = "foo"
7
- Flickrie.shared_secret = "foo"
2
+ def test_tokens
3
+ VCR.use_cassette 'oauth/tokens' do
4
+ Flickrie.api_key = "foo"
5
+ Flickrie.shared_secret = "foo"
8
6
 
9
- assert_raises(Flickrie::OAuth::Error) do
10
- Flickrie::OAuth.get_request_token
11
- end
7
+ assert_raises(Flickrie::OAuth::Error) do
8
+ Flickrie::OAuth.get_request_token
9
+ end
12
10
 
13
- Flickrie.api_key = ENV['FLICKR_API_KEY']
14
- assert_raises(Flickrie::OAuth::Error) do
15
- Flickrie::OAuth.get_request_token
16
- end
11
+ Flickrie.api_key = ENV['FLICKR_API_KEY']
12
+ assert_raises(Flickrie::OAuth::Error) do
13
+ Flickrie::OAuth.get_request_token
14
+ end
17
15
 
18
- Flickrie.shared_secret = ENV['FLICKR_SHARED_SECRET']
19
- assert_nothing_raised { Flickrie::OAuth.get_request_token }
16
+ Flickrie.shared_secret = ENV['FLICKR_SHARED_SECRET']
17
+ assert_nothing_raised { Flickrie::OAuth.get_request_token }
20
18
 
21
- request_token = Flickrie::OAuth.get_request_token
22
- assert_raises(Flickrie::OAuth::Error) do
23
- Flickrie::OAuth.get_access_token("foo", request_token)
19
+ request_token = Flickrie::OAuth.get_request_token
20
+ assert_raises(Flickrie::OAuth::Error) do
21
+ Flickrie::OAuth.get_access_token("foo", request_token)
22
+ end
24
23
  end
25
24
  end
26
25
  end
data/test/photo_test.rb CHANGED
@@ -1,6 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'test'
3
-
4
2
  Flickrie::Photo.instance_eval do
5
3
  def public_new(*args)
6
4
  new(*args)
@@ -20,38 +18,52 @@ class PhotoTest < Test::Unit::TestCase
20
18
  url_sq url_q url_t url_s url_n url_m url_z url_c url_l url_o]
21
19
  end
22
20
 
23
- def test_photos_from_set
24
- photo = Flickrie.photos_from_set(@set_id, :extras => @all_extras).
25
- find { |photo| photo.id.to_i == @photo_id }
26
-
27
- assert_sizes(photo)
21
+ def test_square_brackets
22
+ VCR.use_cassette 'photo/square_brackets' do
23
+ photo = Flickrie.get_photo_info(@photo_id)
24
+ assert_equal 1, photo['usage']['candownload'].to_i
25
+ end
28
26
  end
29
27
 
30
- def test_public_photos_from_user
31
- photo = Flickrie.public_photos_from_user(@user_nsid, :extras => @all_extras).
32
- find { |photo| photo.id.to_i == @photo_id }
28
+ def test_from_set
29
+ VCR.use_cassette 'photo/from_set' do
30
+ photo = Flickrie.photos_from_set(@set_id, :extras => @all_extras).
31
+ find { |photo| photo.id.to_i == @photo_id }
33
32
 
34
- assert_sizes(photo, :exclude => ['Square 150', 'Small 320', 'Medium 800'])
33
+ assert_sizes(photo)
34
+ end
35
35
  end
36
36
 
37
- def test_get_photo_sizes
38
- get_sizes_assertions(Flickrie.get_photo_sizes(@photo_id))
39
- get_sizes_assertions(Flickrie::Photo.public_new('id' => @photo_id.to_s).get_sizes)
37
+ def test_public_from_user
38
+ VCR.use_cassette 'photo/from_user' do
39
+ photo = Flickrie.public_photos_from_user(@user_nsid, :extras => @all_extras).
40
+ find { |photo| photo.id.to_i == @photo_id }
41
+
42
+ assert_sizes(photo, :exclude => ['Square 150', 'Small 320', 'Medium 800'])
43
+ end
40
44
  end
41
45
 
42
- def get_sizes_assertions(photo)
43
- assert_equal true, photo.can_download?
44
- assert_equal true, photo.can_blog?
45
- assert_equal true, photo.can_print?
46
+ def test_get_sizes
47
+ VCR.use_cassette 'photo/get_sizes' do
48
+ [Flickrie.get_photo_sizes(@photo_id),
49
+ Flickrie::Photo.public_new('id' => @photo_id.to_s).get_sizes].
50
+ each do |photo|
51
+ assert_equal true, photo.can_download?
52
+ assert_equal true, photo.can_blog?
53
+ assert_equal true, photo.can_print?
46
54
 
47
- assert_sizes(photo)
55
+ assert_sizes(photo)
56
+ end
57
+ end
48
58
  end
49
59
 
50
- def test_search_photos
51
- photo = Flickrie.search_photos(:user_id => @user_nsid, :extras => @all_extras).
52
- find { |photo| photo.id.to_i == @photo_id }
60
+ def test_search
61
+ VCR.use_cassette 'photo/search' do
62
+ photo = Flickrie.search_photos(:user_id => @user_nsid, :extras => @all_extras).
63
+ find { |photo| photo.id.to_i == @photo_id }
53
64
 
54
- assert_sizes(photo)
65
+ assert_sizes(photo)
66
+ end
55
67
  end
56
68
 
57
69
  def assert_sizes(photo, options = {})
@@ -145,50 +157,56 @@ class PhotoTest < Test::Unit::TestCase
145
157
  end
146
158
  end
147
159
 
148
- def test_photo_upload
149
- photo_path = File.join(File.expand_path(File.dirname(__FILE__)), 'photo.jpg')
150
- photo_id = Flickrie.upload(photo_path)
151
- assert_nothing_raised(Flickrie::Error) { Flickrie.get_photo_info(photo_id) }
152
- Flickrie.delete_photo(photo_id)
160
+ def test_upload
161
+ VCR.use_cassette 'photo/upload' do
162
+ photo_path = File.join(File.expand_path(File.dirname(__FILE__)), 'photo.jpg')
163
+ photo_id = Flickrie.upload(photo_path)
164
+ assert_nothing_raised(Flickrie::Error) { Flickrie.get_photo_info(photo_id) }
165
+ Flickrie.delete_photo(photo_id)
166
+ end
153
167
  end
154
168
 
155
- def test_asynchronous_photo_upload
156
- photo_path = File.join(File.expand_path(File.dirname(__FILE__)), 'photo.jpg')
157
- ticket_id = Flickrie.upload(photo_path, :async => 1)
158
- begin
159
- ticket = Flickrie.check_upload_tickets([ticket_id]).first
160
- end until ticket.complete?
161
- photo_id = ticket.photo_id
162
- assert_nothing_raised(Flickrie::Error) { Flickrie.get_photo_info(photo_id) }
163
- Flickrie.delete_photo(photo_id)
169
+ def test_asynchronous_upload
170
+ VCR.use_cassette 'photo/asynchronous_upload' do
171
+ photo_path = File.join(File.expand_path(File.dirname(__FILE__)), 'photo.jpg')
172
+ ticket_id = Flickrie.upload(photo_path, :async => 1)
173
+ begin
174
+ ticket = Flickrie.check_upload_tickets([ticket_id]).first
175
+ end until ticket.complete?
176
+ photo_id = ticket.photo_id
177
+ assert_nothing_raised(Flickrie::Error) { Flickrie.get_photo_info(photo_id) }
178
+ Flickrie.delete_photo(photo_id)
179
+ end
164
180
  end
165
181
 
166
- def test_get_photo_exif
167
- [
168
- Flickrie.get_photo_exif(@photo_id),
169
- Flickrie::Photo.public_new('id' => @photo_id).get_exif
170
- ].
171
- each do |photo|
172
- assert_equal "Canon PowerShot G12", photo.camera
173
- assert_equal "180 dpi", photo.exif.get('X-Resolution')
174
- assert_equal "180 dpi", photo.exif.get('X-Resolution', :data => 'clean')
175
- assert_equal "180", photo.exif.get('X-Resolution', :data => 'raw')
176
- end
182
+ def test_get_exif
183
+ VCR.use_cassette 'photo/get_exif' do
184
+ [Flickrie.get_photo_exif(@photo_id),
185
+ Flickrie::Photo.public_new('id' => @photo_id).get_exif].
186
+ each do |photo|
187
+ assert_equal "Canon PowerShot G12", photo.camera
188
+ assert_equal "180 dpi", photo.exif.get('X-Resolution')
189
+ assert_equal "180 dpi", photo.exif.get('X-Resolution', :data => 'clean')
190
+ assert_equal "180", photo.exif.get('X-Resolution', :data => 'raw')
191
+ end
192
+ end
177
193
  end
178
194
 
179
195
  def test_other_api_calls
180
- # add_photo_tags, get_photo_info, remove_photo_tag,
181
- # search_photos, photos_from_contacts
182
-
183
- assert_nothing_raised do
184
- Flickrie.add_photo_tags(@photo_id, "janko")
185
- photo = Flickrie.get_photo_info(@photo_id)
186
- tag = photo.tags.find { |tag| tag.content == "janko" }
187
- Flickrie.remove_photo_tag(tag.id)
188
- Flickrie.photos_from_contacts(:include_self => 1)
189
- Flickrie.public_photos_from_user_contacts(@user_nsid, :include_self => 1)
190
- Flickrie.get_photo_context(@photo_id)
191
- Flickrie.search_photos(:user_id => @user_nsid)
196
+ VCR.use_cassette 'photo/other_api_calls' do
197
+ # add_photo_tags, get_photo_info, remove_photo_tag,
198
+ # search_photos, photos_from_contacts
199
+
200
+ assert_nothing_raised do
201
+ Flickrie.add_photo_tags(@photo_id, "janko")
202
+ photo = Flickrie.get_photo_info(@photo_id)
203
+ tag = photo.tags.find { |tag| tag.content == "janko" }
204
+ Flickrie.remove_photo_tag(tag.id)
205
+ Flickrie.photos_from_contacts(:include_self => 1)
206
+ Flickrie.public_photos_from_user_contacts(@user_nsid, :include_self => 1)
207
+ Flickrie.get_photo_context(@photo_id)
208
+ Flickrie.search_photos(:user_id => @user_nsid)
209
+ end
192
210
  end
193
211
  end
194
212
  end
data/test/set_test.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'test'
3
2
 
4
3
  Flickrie::Set.instance_eval do
5
4
  def public_new(*args)
@@ -13,71 +12,81 @@ class SetTest < Test::Unit::TestCase
13
12
  @user_nsid = '67131352@N04'
14
13
  end
15
14
 
16
- def test_get_set_info
17
- get_info_assertions(Flickrie.get_set_info(@set_id))
18
- get_info_assertions(Flickrie::Set.public_new('id' => @set_id.to_s).get_info)
15
+ def test_square_brackets
16
+ VCR.use_cassette 'set/square_brackets' do
17
+ set = Flickrie.get_set_info(@set_id)
18
+ assert_equal @set_id, set['id'].to_i
19
+ end
19
20
  end
20
21
 
21
- def get_info_assertions(set)
22
- assert_equal @set_id, set.id.to_i
23
- assert_equal @user_nsid, set.owner.nsid
24
- assert_equal '6946979188', set.primary_media_id
25
- assert_equal '25bb44852b', set.secret
26
- assert_equal '7049', set.server
27
- assert_equal 8, set.farm
28
- assert_equal 'Speleologija', set.title
29
- assert_equal 'Slike sa škole speleologije Velebit.', set.description
30
-
31
- assert_equal 98, set.media_count
32
- assert_equal 97, set.photos_count
33
- assert_equal 1, set.videos_count
34
- assert_equal 0, set.comments_count
35
- assert_equal 0, set.views_count
36
-
37
- assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
38
- assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
39
- assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
40
- assert set.media.find { |media| media.is_a?(Flickrie::Video) }
41
-
42
- assert_equal true, set.can_comment?
43
-
44
- assert_instance_of Time, set.created_at
45
- assert_instance_of Time, set.updated_at
46
-
47
- refute set.url.empty?
22
+ def test_get_info
23
+ VCR.use_cassette 'set/get_info' do
24
+ [Flickrie.get_set_info(@set_id),
25
+ Flickrie::Set.public_new('id' => @set_id.to_s).get_info].
26
+ each do |set|
27
+ assert_equal @set_id, set.id.to_i
28
+ assert_equal @user_nsid, set.owner.nsid
29
+ assert_equal '6946979188', set.primary_media_id
30
+ assert_equal '25bb44852b', set.secret
31
+ assert_equal '7049', set.server
32
+ assert_equal 8, set.farm
33
+ assert_equal 'Speleologija', set.title
34
+ assert_equal 'Slike sa škole speleologije Velebit.', set.description
35
+
36
+ assert_equal 98, set.media_count
37
+ assert_equal 97, set.photos_count
38
+ assert_equal 1, set.videos_count
39
+ assert_equal 0, set.comments_count
40
+ assert_equal 0, set.views_count
41
+
42
+ assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
43
+ assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
44
+ assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
45
+ assert set.media.find { |media| media.is_a?(Flickrie::Video) }
46
+
47
+ assert_equal true, set.can_comment?
48
+
49
+ assert_instance_of Time, set.created_at
50
+ assert_instance_of Time, set.updated_at
51
+
52
+ refute set.url.empty?
53
+ end
54
+ end
48
55
  end
49
56
 
50
- def test_sets_from_user
51
- set = Flickrie.sets_from_user(@user_nsid).
52
- find { |set| set.id.to_i == @set_id }
53
-
54
- assert_equal @set_id, set.id.to_i
55
- assert_equal @user_nsid, set.owner.nsid
56
- assert_equal '6946979188', set.primary_media_id
57
- assert_equal '25bb44852b', set.secret
58
- assert_equal '7049', set.server
59
- assert_equal 8, set.farm
60
- assert_equal 'Speleologija', set.title
61
- assert_equal 'Slike sa škole speleologije Velebit.', set.description
62
-
63
- assert_equal 98, set.media_count
64
- assert_equal 97, set.photos_count
65
- assert_equal 1, set.videos_count
66
- assert_equal 0, set.comments_count
67
- assert_equal 0, set.views_count
68
-
69
- assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
70
- assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
71
- assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
72
- assert set.media.find { |media| media.is_a?(Flickrie::Video) }
73
-
74
- assert_equal true, set.can_comment?
75
- assert_equal false, set.needs_interstitial?
76
- assert_equal true, set.visibility_can_see_set?
77
-
78
- assert_instance_of Time, set.created_at
79
- assert_instance_of Time, set.updated_at
80
-
81
- refute set.url.empty?
57
+ def test_from_user
58
+ VCR.use_cassette 'set/from_user' do
59
+ set = Flickrie.sets_from_user(@user_nsid).
60
+ find { |set| set.id.to_i == @set_id }
61
+
62
+ assert_equal @set_id, set.id.to_i
63
+ assert_equal @user_nsid, set.owner.nsid
64
+ assert_equal '6946979188', set.primary_media_id
65
+ assert_equal '25bb44852b', set.secret
66
+ assert_equal '7049', set.server
67
+ assert_equal 8, set.farm
68
+ assert_equal 'Speleologija', set.title
69
+ assert_equal 'Slike sa škole speleologije Velebit.', set.description
70
+
71
+ assert_equal 98, set.media_count
72
+ assert_equal 97, set.photos_count
73
+ assert_equal 1, set.videos_count
74
+ assert_equal 0, set.comments_count
75
+ assert_equal 0, set.views_count
76
+
77
+ assert set.photos.all? { |photo| photo.is_a?(Flickrie::Photo) }
78
+ assert set.videos.all? { |video| video.is_a?(Flickrie::Video) }
79
+ assert set.media.find { |media| media.is_a?(Flickrie::Photo) }
80
+ assert set.media.find { |media| media.is_a?(Flickrie::Video) }
81
+
82
+ assert_equal true, set.can_comment?
83
+ assert_equal false, set.needs_interstitial?
84
+ assert_equal true, set.visibility_can_see_set?
85
+
86
+ assert_instance_of Time, set.created_at
87
+ assert_instance_of Time, set.updated_at
88
+
89
+ refute set.url.empty?
90
+ end
82
91
  end
83
92
  end
@@ -5,3 +5,10 @@ Flickrie.api_key = ENV['FLICKR_API_KEY']
5
5
  Flickrie.shared_secret = ENV['FLICKR_SHARED_SECRET']
6
6
  Flickrie.access_token = ENV['FLICKR_ACCESS_TOKEN']
7
7
  Flickrie.access_secret = ENV['FLICKR_ACCESS_SECRET']
8
+
9
+ require 'vcr'
10
+
11
+ VCR.configure do |c|
12
+ c.cassette_library_dir = 'test/vcr_cassettes'
13
+ c.hook_into :webmock
14
+ end
data/test/user_test.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  # encoding: utf-8
2
- require 'test'
3
2
 
4
3
  Flickrie::User.instance_eval do
5
4
  def public_new(*args)
@@ -12,50 +11,60 @@ class UserTest < Test::Unit::TestCase
12
11
  @user_nsid = '67131352@N04'
13
12
  end
14
13
 
15
- def test_get_user_info
16
- get_info_assertions(Flickrie.get_user_info(@user_nsid))
17
- get_info_assertions(Flickrie::User.public_new('nsid' => @user_nsid).get_info)
14
+ def test_square_brackets
15
+ VCR.use_cassette 'user/square_brackets' do
16
+ user = Flickrie.get_user_info(@user_nsid)
17
+ assert_equal user['nsid'], user.nsid
18
+ end
18
19
  end
19
20
 
20
- def get_info_assertions(user)
21
- assert_equal @user_nsid, user.id
22
- assert_equal @user_nsid, user.nsid
23
- assert_equal 'Janko Marohnić', user.username
24
- assert_equal 'Janko Marohnić', user.real_name
25
- assert_equal 'Zagreb, Croatia', user.location
26
- assert_equal 'Sarajevo, Skopje, Warsaw, Zagreb', user.time_zone['label']
27
- assert_equal '+01:00', user.time_zone['offset']
28
- assert_equal <<-DESCRIPTION.chomp, user.description
29
- I'm a programmer, and I'm gonna program a badass Ruby library for Flickr.
30
- DESCRIPTION
21
+ def test_get_info
22
+ VCR.use_cassette 'user/get_info' do
23
+ [Flickrie.get_user_info(@user_nsid),
24
+ Flickrie::User.public_new('nsid' => @user_nsid).get_info].
25
+ each do |user|
26
+ assert_equal @user_nsid, user.id
27
+ assert_equal @user_nsid, user.nsid
28
+ assert_equal 'Janko Marohnić', user.username
29
+ assert_equal 'Janko Marohnić', user.real_name
30
+ assert_equal 'Zagreb, Croatia', user.location
31
+ assert_equal 'Sarajevo, Skopje, Warsaw, Zagreb', user.time_zone['label']
32
+ assert_equal '+01:00', user.time_zone['offset']
33
+ assert_equal <<-DESCRIPTION.chomp.lstrip, user.description
34
+ I'm a programmer, and I'm gonna program a badass Ruby library for Flickr.
35
+ DESCRIPTION
31
36
 
32
- refute user.profile_url.empty?
33
- refute user.mobile_url.empty?
34
- refute user.photos_url.empty?
37
+ refute user.profile_url.empty?
38
+ refute user.mobile_url.empty?
39
+ refute user.photos_url.empty?
35
40
 
36
- assert_equal '5464', user.icon_server
37
- assert_equal 6, user.icon_farm
38
- refute user.buddy_icon_url.empty?
41
+ assert_equal '5464', user.icon_server
42
+ assert_equal 6, user.icon_farm
43
+ refute user.buddy_icon_url.empty?
39
44
 
40
- assert_equal false, user.pro?
45
+ assert_equal false, user.pro?
41
46
 
42
- assert_instance_of Time, user.first_taken
43
- assert_instance_of Time, user.first_uploaded
47
+ assert_instance_of Time, user.first_taken
48
+ assert_instance_of Time, user.first_uploaded
44
49
 
45
- assert_equal 98, user.media_count
50
+ assert_equal 98, user.media_count
51
+ end
52
+ end
46
53
  end
47
54
 
48
- def test_find_user_by_username_or_email
49
- user = Flickrie.find_user_by_username('Janko Marohnić')
55
+ def test_find_by_username_or_email
56
+ VCR.use_cassette 'user/find_by_email_or_username' do
57
+ user = Flickrie.find_user_by_username('Janko Marohnić')
50
58
 
51
- assert_equal @user_nsid, user.id
52
- assert_equal @user_nsid, user.nsid
53
- assert_equal 'Janko Marohnić', user.username
59
+ assert_equal @user_nsid, user.id
60
+ assert_equal @user_nsid, user.nsid
61
+ assert_equal 'Janko Marohnić', user.username
54
62
 
55
- user = Flickrie.find_user_by_email('janko.marohnic@gmail.com')
63
+ user = Flickrie.find_user_by_email('janko.marohnic@gmail.com')
56
64
 
57
- assert_equal @user_nsid, user.id
58
- assert_equal @user_nsid, user.nsid
59
- assert_equal 'Janko Marohnić', user.username
65
+ assert_equal @user_nsid, user.id
66
+ assert_equal @user_nsid, user.nsid
67
+ assert_equal 'Janko Marohnić', user.username
68
+ end
60
69
  end
61
70
  end