picasa 0.5.4 → 0.6.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.
- data/.gitignore +2 -0
- data/.travis.yml +4 -9
- data/Gemfile +4 -4
- data/README.md +4 -12
- data/extra/Thorfile +0 -3
- data/lib/picasa.rb +1 -8
- data/lib/picasa/api/album.rb +11 -11
- data/lib/picasa/api/base.rb +0 -3
- data/lib/picasa/api/comment.rb +6 -8
- data/lib/picasa/api/photo.rb +9 -9
- data/lib/picasa/api/tag.rb +6 -8
- data/lib/picasa/client.rb +2 -2
- data/lib/picasa/connection.rb +14 -51
- data/lib/picasa/exceptions.rb +1 -0
- data/lib/picasa/file.rb +8 -0
- data/lib/picasa/http.rb +28 -0
- data/lib/picasa/presenter/album.rb +15 -15
- data/lib/picasa/presenter/album_list.rb +10 -10
- data/lib/picasa/presenter/comment.rb +6 -6
- data/lib/picasa/presenter/comment_list.rb +10 -10
- data/lib/picasa/presenter/media.rb +5 -5
- data/lib/picasa/presenter/photo.rb +15 -15
- data/lib/picasa/presenter/tag.rb +3 -3
- data/lib/picasa/presenter/tag_list.rb +10 -10
- data/lib/picasa/utils.rb +11 -13
- data/lib/picasa/version.rb +1 -1
- data/picasa.gemspec +2 -1
- data/test/api/album_test.rb +163 -20
- data/test/api/comment_test.rb +95 -10
- data/test/api/photo_test.rb +27 -11
- data/test/api/tag_test.rb +84 -13
- data/test/cassettes/album-404.yml +52 -0
- data/test/cassettes/album-create.yml +107 -0
- data/test/cassettes/album-destroy.yml +55 -0
- data/test/cassettes/album-list.yml +85 -0
- data/test/cassettes/album-show.yml +123 -0
- data/test/cassettes/auth-failed.yml +50 -0
- data/test/cassettes/auth-success.yml +64 -0
- data/test/cassettes/comment-400.yml +56 -0
- data/test/cassettes/comment-create.yml +88 -0
- data/test/cassettes/comment-destroy.yml +53 -0
- data/test/cassettes/comment-list.yml +87 -0
- data/test/cassettes/photo-412.yml +58 -0
- data/test/cassettes/photo-create.yml +1908 -0
- data/test/cassettes/photo-destroy.yml +55 -0
- data/test/cassettes/tag-create.yml +85 -0
- data/test/cassettes/tag-destroy.yml +53 -0
- data/test/cassettes/tag-list.yml +79 -0
- data/test/client_test.rb +10 -10
- data/test/connection_test.rb +0 -35
- data/test/helper.rb +21 -7
- data/test/utils_test.rb +0 -6
- metadata +37 -40
- data/test/fixtures/album/album-create.txt +0 -21
- data/test/fixtures/album/album-list-with-tag.txt +0 -105
- data/test/fixtures/album/album-list.txt +0 -105
- data/test/fixtures/album/album-show-with-max-results.txt +0 -131
- data/test/fixtures/album/album-show-with-tag-and-many-photos.txt +0 -156
- data/test/fixtures/album/album-show-with-tag-and-one-photo.txt +0 -105
- data/test/fixtures/album/album-show.txt +0 -169
- data/test/fixtures/auth/success.txt +0 -14
- data/test/fixtures/comment/comment-list.txt +0 -65
- data/test/fixtures/exceptions/forbidden.txt +0 -12
- data/test/fixtures/exceptions/not_found.txt +0 -14
- data/test/fixtures/exceptions/precondition_failed.txt +0 -14
- data/test/fixtures/json.txt +0 -435
- data/test/fixtures/photo/photo-created.txt +0 -21
- data/test/fixtures/photo/photo-list-all-with-q.txt +0 -556
- data/test/fixtures/photo/photo-list-all.txt +0 -623
- data/test/fixtures/photo/photo-list-user.txt +0 -388
- data/test/fixtures/presenters/album_list.xml +0 -88
- data/test/fixtures/presenters/album_show.xml +0 -152
- data/test/fixtures/presenters/album_show_with_one_photo.xml +0 -88
- data/test/fixtures/presenters/comment_list.xml +0 -48
- data/test/fixtures/presenters/tag_list.xml +0 -51
- data/test/fixtures/tag/tag-list.txt +0 -68
- data/test/presenter/album_list_test.rb +0 -67
- data/test/presenter/album_test.rb +0 -189
- data/test/presenter/author_test.rb +0 -17
- data/test/presenter/base_test.rb +0 -50
- data/test/presenter/comment_list_test.rb +0 -67
- data/test/presenter/comment_test.rb +0 -56
- data/test/presenter/content_test.rb +0 -18
- data/test/presenter/link_test.rb +0 -21
- data/test/presenter/media_test.rb +0 -29
- data/test/presenter/photo_test.rb +0 -90
- data/test/presenter/tag_list_test.rb +0 -67
- data/test/presenter/tag_test.rb +0 -48
- data/test/presenter/thumbnail_test.rb +0 -24
data/lib/picasa/utils.rb
CHANGED
@@ -4,23 +4,21 @@ require "cgi"
|
|
4
4
|
module Picasa
|
5
5
|
module Utils
|
6
6
|
def safe_retrieve(hash, *keys)
|
7
|
+
result = retrieve(hash, keys)
|
8
|
+
if result.kind_of?(Hash) && result.has_key?('$t') && result.keys.size == 1
|
9
|
+
result['$t']
|
10
|
+
else
|
11
|
+
result
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def retrieve(hash, keys)
|
7
16
|
return if !hash.kind_of?(Hash) || !hash.has_key?(keys.first)
|
8
17
|
|
9
18
|
if keys.size == 1
|
10
19
|
hash[keys.first]
|
11
20
|
elsif keys.size > 1
|
12
|
-
Utils.
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
# Ported from activesupport gem
|
17
|
-
def array_wrap(object)
|
18
|
-
if object.nil?
|
19
|
-
[]
|
20
|
-
elsif object.respond_to?(:to_ary)
|
21
|
-
object.to_ary || [object]
|
22
|
-
else
|
23
|
-
[object]
|
21
|
+
Utils.retrieve(hash[keys.first], keys[1..-1])
|
24
22
|
end
|
25
23
|
end
|
26
24
|
|
@@ -47,6 +45,6 @@ module Picasa
|
|
47
45
|
end.join("&")
|
48
46
|
end
|
49
47
|
|
50
|
-
module_function :safe_retrieve, :
|
48
|
+
module_function :safe_retrieve, :retrieve, :map_to_integer, :map_to_boolean, :map_to_date, :inline_query
|
51
49
|
end
|
52
50
|
end
|
data/lib/picasa/version.rb
CHANGED
data/picasa.gemspec
CHANGED
@@ -15,8 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Picasa::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "
|
18
|
+
gem.add_dependency "httparty"
|
19
19
|
|
20
20
|
gem.add_development_dependency "webmock"
|
21
21
|
gem.add_development_dependency "mocha"
|
22
|
+
gem.add_development_dependency "vcr"
|
22
23
|
end
|
data/test/api/album_test.rb
CHANGED
@@ -3,44 +3,187 @@ require "helper"
|
|
3
3
|
|
4
4
|
describe Picasa::API::Album do
|
5
5
|
describe "#list" do
|
6
|
-
|
7
|
-
|
6
|
+
before do
|
7
|
+
VCR.use_cassette("album-list") do
|
8
|
+
@album_list = Picasa::API::Album.new(:user_id => "w.wnetrzak").list
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
it "has author name" do
|
13
|
+
assert_equal "Wojciech Wnętrzak", @album_list.author.name
|
14
|
+
end
|
15
|
+
|
16
|
+
it "has author uri" do
|
17
|
+
assert_equal "https://picasaweb.google.com/106136347770555028022", @album_list.author.uri
|
18
|
+
end
|
19
|
+
|
20
|
+
it "has links" do
|
21
|
+
assert_equal 4, @album_list.links.size
|
22
|
+
end
|
23
|
+
|
24
|
+
it "has title" do
|
25
|
+
assert_equal "106136347770555028022", @album_list.title
|
26
|
+
end
|
8
27
|
|
9
|
-
|
28
|
+
it "has updated" do
|
29
|
+
assert_equal "2012-11-01T04:47:09+00:00", @album_list.updated.to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
it "has icon" do
|
33
|
+
expected = "https://lh3.googleusercontent.com/-6ezHc54U8x0/AAAAAAAAAAI/AAAAAAAAAAA/PBuxm7Ehn6E/s64-c/106136347770555028022.jpg"
|
34
|
+
assert_equal expected, @album_list.icon
|
35
|
+
end
|
36
|
+
|
37
|
+
it "has generator" do
|
38
|
+
assert_equal "Picasaweb", @album_list.generator
|
39
|
+
end
|
40
|
+
|
41
|
+
it "has total_results" do
|
42
|
+
assert_equal 1, @album_list.total_results
|
43
|
+
end
|
44
|
+
|
45
|
+
it "has start_index" do
|
46
|
+
assert_equal 1, @album_list.start_index
|
47
|
+
end
|
10
48
|
|
11
|
-
|
49
|
+
it "has items_per_page" do
|
50
|
+
assert_equal 1000, @album_list.items_per_page
|
51
|
+
end
|
52
|
+
|
53
|
+
it "has user" do
|
54
|
+
assert_equal "106136347770555028022", @album_list.user
|
55
|
+
end
|
56
|
+
|
57
|
+
it "has nickname" do
|
58
|
+
assert_equal "Wojciech Wnętrzak", @album_list.nickname
|
59
|
+
end
|
60
|
+
|
61
|
+
it "has thumbnail" do
|
62
|
+
expected = "https://lh3.googleusercontent.com/-6ezHc54U8x0/AAAAAAAAAAI/AAAAAAAAAAA/PBuxm7Ehn6E/s64-c/106136347770555028022.jpg"
|
63
|
+
assert_equal expected, @album_list.thumbnail
|
64
|
+
end
|
65
|
+
|
66
|
+
it "has entries" do
|
67
|
+
assert_equal 1, @album_list.entries.size
|
12
68
|
end
|
13
69
|
end
|
14
70
|
|
15
71
|
describe "#show" do
|
16
|
-
|
17
|
-
|
72
|
+
before do
|
73
|
+
VCR.use_cassette("album-show") do
|
74
|
+
@album = Picasa::API::Album.new(:user_id => "w.wnetrzak").show("5239555770355467953")
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
it "has author name" do
|
79
|
+
assert_equal "Wojciech Wnętrzak", @album.author.name
|
80
|
+
end
|
81
|
+
|
82
|
+
it "has author uri" do
|
83
|
+
assert_equal "https://picasaweb.google.com/106136347770555028022", @album.author.uri
|
84
|
+
end
|
85
|
+
|
86
|
+
it "has links" do
|
87
|
+
assert_equal 5, @album.links.size
|
88
|
+
end
|
89
|
+
|
90
|
+
it "has published" do
|
91
|
+
assert_nil @album.published
|
92
|
+
end
|
18
93
|
|
19
|
-
|
94
|
+
it "has updated" do
|
95
|
+
assert_equal "2012-10-25T00:32:52+00:00", @album.updated.to_s
|
96
|
+
end
|
97
|
+
|
98
|
+
it "has title" do
|
99
|
+
assert_equal "test", @album.title
|
100
|
+
end
|
101
|
+
|
102
|
+
it "has summary" do
|
103
|
+
assert_nil @album.summary
|
104
|
+
end
|
105
|
+
|
106
|
+
it "has rights" do
|
107
|
+
assert_equal "public", @album.rights
|
108
|
+
end
|
109
|
+
|
110
|
+
it "has id" do
|
111
|
+
assert_equal "5239555770355467953", @album.id
|
112
|
+
end
|
20
113
|
|
21
|
-
|
114
|
+
it "has etag" do
|
115
|
+
assert_equal "W/\"D0YDQ3s-fyp7ImA9WhNSEU8.\"", @album.etag
|
116
|
+
end
|
117
|
+
|
118
|
+
it "has name" do
|
119
|
+
assert_equal "Test", @album.name
|
120
|
+
end
|
121
|
+
|
122
|
+
it "has location" do
|
123
|
+
assert_equal "gdzieś", @album.location
|
124
|
+
end
|
125
|
+
|
126
|
+
it "has access" do
|
127
|
+
assert_equal "public", @album.access
|
128
|
+
end
|
129
|
+
|
130
|
+
it "has timestamp" do
|
131
|
+
assert_equal "1219906800000", @album.timestamp
|
132
|
+
end
|
133
|
+
|
134
|
+
it "has numphotos" do
|
135
|
+
assert_equal 6, @album.numphotos
|
136
|
+
end
|
137
|
+
|
138
|
+
it "has user" do
|
139
|
+
assert_equal "106136347770555028022", @album.user
|
140
|
+
end
|
141
|
+
|
142
|
+
it "has nickname" do
|
143
|
+
assert_equal "Wojciech Wnętrzak", @album.nickname
|
144
|
+
end
|
145
|
+
|
146
|
+
it "has photo entries" do
|
147
|
+
assert_equal 6, @album.entries.size
|
148
|
+
end
|
149
|
+
|
150
|
+
it "has allow_prints" do
|
151
|
+
assert_equal true, @album.allow_prints
|
152
|
+
end
|
153
|
+
|
154
|
+
it "has allow_downloads" do
|
155
|
+
assert_equal true, @album.allow_downloads
|
22
156
|
end
|
23
157
|
end
|
24
158
|
|
25
|
-
describe "
|
26
|
-
it "
|
27
|
-
|
28
|
-
|
159
|
+
describe "exceptions" do
|
160
|
+
it "raises NotFound exception when album does not exist" do
|
161
|
+
VCR.use_cassette("album-404") do
|
162
|
+
assert_raises Picasa::NotFoundError, "Invalid entity id: non-existing" do
|
163
|
+
Picasa::API::Album.new(:user_id => "w.wnetrzak").show("non-exisiting")
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
29
168
|
|
30
|
-
|
169
|
+
describe "#create" do
|
170
|
+
it "creates album" do
|
171
|
+
VCR.use_cassette("album-create") do
|
172
|
+
attributes = {:title => "gem-test", :summary => "created from test suite", :access => "protected",
|
173
|
+
:location => "Gilowice", :keywords => "test"}
|
174
|
+
album = Picasa::API::Album.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).create(attributes)
|
31
175
|
|
32
|
-
|
176
|
+
assert_equal "gem-test", album.title
|
177
|
+
end
|
33
178
|
end
|
34
179
|
end
|
35
180
|
|
36
181
|
describe "#destroy" do
|
37
182
|
it "gives true when success" do
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
assert_equal true, result
|
183
|
+
VCR.use_cassette("album-destroy") do
|
184
|
+
result = Picasa::API::Album.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).destroy("5805920347758933777")
|
185
|
+
assert_equal true, result
|
186
|
+
end
|
44
187
|
end
|
45
188
|
end
|
46
189
|
end
|
data/test/api/comment_test.rb
CHANGED
@@ -3,6 +3,12 @@ require "helper"
|
|
3
3
|
|
4
4
|
describe Picasa::API::Comment do
|
5
5
|
describe "#list" do
|
6
|
+
before do
|
7
|
+
VCR.use_cassette("comment-list") do
|
8
|
+
@comment_list = Picasa::API::Comment.new(:user_id => "w.wnetrzak").list(:album_id => "5239555770355467953")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
6
12
|
it "throws ArgumentError when photo_id provided without album_id" do
|
7
13
|
comment = Picasa::API::Comment.new(:user_id => "w.wnetrzak")
|
8
14
|
|
@@ -11,16 +17,80 @@ describe Picasa::API::Comment do
|
|
11
17
|
end
|
12
18
|
end
|
13
19
|
|
14
|
-
it "
|
15
|
-
|
20
|
+
it "has author name" do
|
21
|
+
assert_equal "Wojciech Wnętrzak", @comment_list.author.name
|
22
|
+
end
|
23
|
+
|
24
|
+
it "has author uri" do
|
25
|
+
assert_equal "https://picasaweb.google.com/106136347770555028022", @comment_list.author.uri
|
26
|
+
end
|
27
|
+
|
28
|
+
it "has links" do
|
29
|
+
assert_equal 5, @comment_list.links.size
|
30
|
+
end
|
31
|
+
|
32
|
+
it "has title" do
|
33
|
+
assert_equal "test", @comment_list.title
|
34
|
+
end
|
35
|
+
|
36
|
+
it "has updated" do
|
37
|
+
assert_equal "2012-10-25T00:32:51+00:00", @comment_list.updated.to_s
|
38
|
+
end
|
39
|
+
|
40
|
+
it "has icon" do
|
41
|
+
expected = "https://lh6.googleusercontent.com/-ZqXRf3HicvI/SLakNnjixrE/AAAAAAAAAkc/3EAZ0eF3-CQ/s160-c/Test.jpg"
|
42
|
+
assert_equal expected, @comment_list.icon
|
43
|
+
end
|
44
|
+
|
45
|
+
it "has generator" do
|
46
|
+
assert_equal "Picasaweb", @comment_list.generator
|
47
|
+
end
|
48
|
+
|
49
|
+
it "has total_results" do
|
50
|
+
assert_equal 1, @comment_list.total_results
|
51
|
+
end
|
52
|
+
|
53
|
+
it "has start_index" do
|
54
|
+
assert_equal 1, @comment_list.start_index
|
55
|
+
end
|
56
|
+
|
57
|
+
it "has items_per_page" do
|
58
|
+
assert_equal 500, @comment_list.items_per_page
|
59
|
+
end
|
60
|
+
|
61
|
+
it "has user" do
|
62
|
+
assert_equal "106136347770555028022", @comment_list.user
|
63
|
+
end
|
16
64
|
|
17
|
-
|
65
|
+
it "has nickname" do
|
66
|
+
assert_equal "Wojciech Wnętrzak", @comment_list.nickname
|
67
|
+
end
|
68
|
+
|
69
|
+
it "has entries" do
|
70
|
+
assert_equal 1, @comment_list.entries.size
|
71
|
+
end
|
18
72
|
|
19
|
-
|
73
|
+
it "has content" do
|
74
|
+
assert_equal "beautiful place", @comment_list.entries.first.content
|
75
|
+
end
|
76
|
+
|
77
|
+
it "has id" do
|
78
|
+
expected = "z13fufdr3znxifia004cgjbgjkmwyr5ot4g-1351125171797000"
|
79
|
+
assert_equal expected, @comment_list.entries.first.id
|
20
80
|
end
|
21
81
|
end
|
22
82
|
|
23
83
|
describe "#create" do
|
84
|
+
it "creates comment" do
|
85
|
+
VCR.use_cassette("comment-create") do
|
86
|
+
attributes = {:album_id => "5793892606777564353", :photo_id => "5806295577614146146", :content => "żółć"}
|
87
|
+
|
88
|
+
comment = Picasa::API::Comment.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).create(attributes)
|
89
|
+
|
90
|
+
assert_equal "żółć", comment.content
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
24
94
|
it "raises ArgumentError when no album_id" do
|
25
95
|
comment = Picasa::API::Comment.new(:user_id => "w.wnetrzak@gmail.com", :password => "secret")
|
26
96
|
assert_raises Picasa::ArgumentError, /album_id/ do
|
@@ -44,6 +114,17 @@ describe Picasa::API::Comment do
|
|
44
114
|
end
|
45
115
|
|
46
116
|
describe "#destroy" do
|
117
|
+
it "destroys comment" do
|
118
|
+
VCR.use_cassette("comment-destroy") do
|
119
|
+
comment_id = "z13aebo5hvi5gjtj004cgjbgjkmwyr5ot4g-1351896079590000"
|
120
|
+
attributes = {:album_id => "5793892606777564353", :photo_id => "5806295577614146146"}
|
121
|
+
|
122
|
+
result = Picasa::API::Comment.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).destroy(comment_id, attributes)
|
123
|
+
|
124
|
+
assert_equal true, result
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
47
128
|
it "raises ArgumentError when no photo_id" do
|
48
129
|
comment = Picasa::API::Comment.new(:user_id => "w.wnetrzak@gmail.com", :password => "secret")
|
49
130
|
assert_raises Picasa::ArgumentError, /photo_id/ do
|
@@ -57,14 +138,18 @@ describe Picasa::API::Comment do
|
|
57
138
|
comment.destroy("wtf", :photo_id => "455")
|
58
139
|
end
|
59
140
|
end
|
141
|
+
end
|
60
142
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
143
|
+
describe "exceptions" do
|
144
|
+
it "raises BadRequest exception when bad comment id given" do
|
145
|
+
VCR.use_cassette("comment-400") do
|
146
|
+
comment_id = "13fufdr3znxifia004cgjbgjkmwyr5ot4g-1351125171797000"
|
147
|
+
attributes = {:album_id => "5793892606777564353", :photo_id => "5806295577614146146"}
|
66
148
|
|
67
|
-
|
149
|
+
assert_raises Picasa::BadRequestError, "Invalid entity id: non-existing" do
|
150
|
+
Picasa::API::Comment.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).destroy(comment_id, attributes)
|
151
|
+
end
|
152
|
+
end
|
68
153
|
end
|
69
154
|
end
|
70
155
|
end
|
data/test/api/photo_test.rb
CHANGED
@@ -3,14 +3,14 @@ require "helper"
|
|
3
3
|
|
4
4
|
describe Picasa::API::Photo do
|
5
5
|
describe "#create" do
|
6
|
-
it "
|
7
|
-
|
8
|
-
|
6
|
+
it "creates photo" do
|
7
|
+
VCR.use_cassette("photo-create") do
|
8
|
+
attributes = {:file_path => image_path("lena.jpg"), :title => "Lena"}
|
9
9
|
|
10
|
-
|
11
|
-
photo_create = photo.create("123", :title => "test", :binary => "binary", :content_type => "image/png")
|
10
|
+
photo = Picasa::API::Photo.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).create("5793892606777564353", attributes)
|
12
11
|
|
13
|
-
|
12
|
+
assert_equal "Lena", photo.title
|
13
|
+
end
|
14
14
|
end
|
15
15
|
|
16
16
|
it "raises ArgumentError when no title" do
|
@@ -33,14 +33,30 @@ describe Picasa::API::Photo do
|
|
33
33
|
photo.create("123", :title => "test", :binary => "binary")
|
34
34
|
end
|
35
35
|
end
|
36
|
+
end
|
36
37
|
|
37
|
-
|
38
|
-
|
39
|
-
|
38
|
+
describe "#destroy" do
|
39
|
+
it "destroys photo" do
|
40
|
+
VCR.use_cassette("photo-destroy") do
|
41
|
+
album_id = "5793892606777564353"
|
42
|
+
photo_id = "5806295577614146146"
|
43
|
+
result = Picasa::API::Photo.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).destroy(album_id, photo_id)
|
40
44
|
|
41
|
-
|
45
|
+
assert_equal true, result
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
42
49
|
|
43
|
-
|
50
|
+
describe "exceptions" do
|
51
|
+
it "raises PreconditionFailedError exception when photo not fresh" do
|
52
|
+
VCR.use_cassette("photo-412") do
|
53
|
+
album_id = "5793892606777564353"
|
54
|
+
photo_id = "5806295577614146146"
|
55
|
+
|
56
|
+
assert_raises Picasa::PreconditionFailedError, "Mismatch: etags = [Not-Fresh], version = [8]" do
|
57
|
+
Picasa::API::Photo.new(:user_id => "w.wnetrzak@gmail.com", :authorization_header => AuthHeader).destroy(album_id, photo_id, :etag => "Not-Fresh")
|
58
|
+
end
|
59
|
+
end
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|