picasa 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +2 -2
- data/VERSION.yml +2 -2
- data/lib/picasa/web_albums.rb +1 -1
- data/picasa.gemspec +9 -7
- data/test/config_test.rb +21 -0
- data/test/test_helper.rb +1 -4
- data/test/web_albums_test.rb +43 -0
- metadata +7 -5
- data/test/picasa_test.rb +0 -60
data/Rakefile
CHANGED
@@ -13,8 +13,8 @@ begin
|
|
13
13
|
gem.homepage = "http://github.com/morgoth/picasa"
|
14
14
|
gem.authors = ["Wojciech Wnętrzak"]
|
15
15
|
gem.add_dependency('xml-simple')
|
16
|
-
gem.add_development_dependency
|
17
|
-
gem.add_development_dependency
|
16
|
+
gem.add_development_dependency 'test-unit', '>=2.0.6'
|
17
|
+
gem.add_development_dependency 'fakeweb'
|
18
18
|
|
19
19
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
20
20
|
end
|
data/VERSION.yml
CHANGED
data/lib/picasa/web_albums.rb
CHANGED
data/picasa.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{picasa}
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Wojciech Wnętrzak"]
|
@@ -27,10 +27,11 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/picasa/config.rb",
|
28
28
|
"lib/picasa/web_albums.rb",
|
29
29
|
"picasa.gemspec",
|
30
|
+
"test/config_test.rb",
|
30
31
|
"test/fixtures/albums",
|
31
32
|
"test/fixtures/photos",
|
32
|
-
"test/
|
33
|
-
"test/
|
33
|
+
"test/test_helper.rb",
|
34
|
+
"test/web_albums_test.rb"
|
34
35
|
]
|
35
36
|
s.homepage = %q{http://github.com/morgoth/picasa}
|
36
37
|
s.rdoc_options = ["--charset=UTF-8"]
|
@@ -38,7 +39,8 @@ Gem::Specification.new do |s|
|
|
38
39
|
s.rubygems_version = %q{1.3.5}
|
39
40
|
s.summary = %q{simple google picasa managment}
|
40
41
|
s.test_files = [
|
41
|
-
"test/
|
42
|
+
"test/web_albums_test.rb",
|
43
|
+
"test/config_test.rb",
|
42
44
|
"test/test_helper.rb"
|
43
45
|
]
|
44
46
|
|
@@ -48,16 +50,16 @@ Gem::Specification.new do |s|
|
|
48
50
|
|
49
51
|
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
52
|
s.add_runtime_dependency(%q<xml-simple>, [">= 0"])
|
51
|
-
s.add_development_dependency(%q<
|
53
|
+
s.add_development_dependency(%q<test-unit>, [">= 2.0.6"])
|
52
54
|
s.add_development_dependency(%q<fakeweb>, [">= 0"])
|
53
55
|
else
|
54
56
|
s.add_dependency(%q<xml-simple>, [">= 0"])
|
55
|
-
s.add_dependency(%q<
|
57
|
+
s.add_dependency(%q<test-unit>, [">= 2.0.6"])
|
56
58
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
57
59
|
end
|
58
60
|
else
|
59
61
|
s.add_dependency(%q<xml-simple>, [">= 0"])
|
60
|
-
s.add_dependency(%q<
|
62
|
+
s.add_dependency(%q<test-unit>, [">= 2.0.6"])
|
61
63
|
s.add_dependency(%q<fakeweb>, [">= 0"])
|
62
64
|
end
|
63
65
|
end
|
data/test/config_test.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class ConfigTest < Test::Unit::TestCase
|
4
|
+
test "Not raise argument error if google user is set by configuration block" do
|
5
|
+
Picasa.config do |c|
|
6
|
+
c.google_user = 'some.user'
|
7
|
+
end
|
8
|
+
assert_nothing_raised do
|
9
|
+
Picasa::WebAlbums.new(nil)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
test "Take user passed to method instead of config" do
|
14
|
+
Picasa.config do |c|
|
15
|
+
c.google_user = 'some.user'
|
16
|
+
end
|
17
|
+
assert_equal 'some.user', Picasa.config.google_user
|
18
|
+
Picasa::WebAlbums.new('important.user')
|
19
|
+
assert_equal 'important.user', Picasa.config.google_user
|
20
|
+
end
|
21
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,15 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
gem 'test-unit'
|
2
3
|
require 'test/unit'
|
3
|
-
require 'shoulda'
|
4
4
|
require 'fakeweb'
|
5
5
|
|
6
6
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
7
7
|
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
8
8
|
require 'picasa'
|
9
9
|
|
10
|
-
class Test::Unit::TestCase
|
11
|
-
end
|
12
|
-
|
13
10
|
def fixture_file(filename)
|
14
11
|
return '' if filename == ''
|
15
12
|
file_path = File.expand_path(File.dirname(__FILE__) + '/fixtures/' + filename)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class WebAlbumsTest < Test::Unit::TestCase
|
4
|
+
test 'Should parse albums page' do
|
5
|
+
page = fixture_file('albums')
|
6
|
+
FakeWeb.register_uri(:get, "picasaweb.google.com/data/feed/api/user/some.user", :response => page)
|
7
|
+
|
8
|
+
albums = Picasa.albums(:google_user => 'some.user')
|
9
|
+
assert_equal 5, albums.count
|
10
|
+
assert_equal "SAPS in da akcion :P", albums.first[:title]
|
11
|
+
assert_equal 10, albums[2][:photos_count]
|
12
|
+
assert_equal "5277503612406515713", albums.first[:id]
|
13
|
+
assert_not_nil albums.first[:photo]
|
14
|
+
assert_not_nil albums.first[:thumbnail]
|
15
|
+
end
|
16
|
+
|
17
|
+
test 'Should parse photos page' do
|
18
|
+
page = fixture_file('photos')
|
19
|
+
FakeWeb.register_uri(:get, "picasaweb.google.com/data/feed/api/user/some.user/albumid/666", :response => page)
|
20
|
+
|
21
|
+
photos = Picasa.photos(:google_user => 'some.user', :album_id => '666')
|
22
|
+
assert_equal 10, photos[:photos].count
|
23
|
+
assert_not_nil photos[:slideshow]
|
24
|
+
assert_not_nil photos[:photos].first[:thumbnail_1]
|
25
|
+
assert_not_nil photos[:photos].first[:thumbnail_2]
|
26
|
+
assert_not_nil photos[:photos].first[:thumbnail_3]
|
27
|
+
assert_nil photos[:photos].first[:title]
|
28
|
+
assert_equal "http://lh5.ggpht.com/_Kp7xCOU0f_U/SQS8EFqEXjI/AAAAAAAAAFo/aUOA6byXAuE/Jurek.JPG",
|
29
|
+
photos[:photos].first[:photo]
|
30
|
+
end
|
31
|
+
|
32
|
+
test "Raise argument error if google user is not present" do
|
33
|
+
assert_raise ArgumentError do
|
34
|
+
Picasa::WebAlbums.new
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
test "Raise argument error if album_id is not present" do
|
39
|
+
assert_raise ArgumentError do
|
40
|
+
Picasa.photos :google_user => 'some.user'
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: picasa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Wojciech Wn\xC4\x99trzak"
|
@@ -23,14 +23,14 @@ dependencies:
|
|
23
23
|
version: "0"
|
24
24
|
version:
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
|
-
name:
|
26
|
+
name: test-unit
|
27
27
|
type: :development
|
28
28
|
version_requirement:
|
29
29
|
version_requirements: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.0.6
|
34
34
|
version:
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: fakeweb
|
@@ -62,10 +62,11 @@ files:
|
|
62
62
|
- lib/picasa/config.rb
|
63
63
|
- lib/picasa/web_albums.rb
|
64
64
|
- picasa.gemspec
|
65
|
+
- test/config_test.rb
|
65
66
|
- test/fixtures/albums
|
66
67
|
- test/fixtures/photos
|
67
|
-
- test/picasa_test.rb
|
68
68
|
- test/test_helper.rb
|
69
|
+
- test/web_albums_test.rb
|
69
70
|
has_rdoc: true
|
70
71
|
homepage: http://github.com/morgoth/picasa
|
71
72
|
licenses: []
|
@@ -95,5 +96,6 @@ signing_key:
|
|
95
96
|
specification_version: 3
|
96
97
|
summary: simple google picasa managment
|
97
98
|
test_files:
|
98
|
-
- test/
|
99
|
+
- test/web_albums_test.rb
|
100
|
+
- test/config_test.rb
|
99
101
|
- test/test_helper.rb
|
data/test/picasa_test.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class PicasaTest < Test::Unit::TestCase
|
4
|
-
context 'with albums page' do
|
5
|
-
setup do
|
6
|
-
page = fixture_file('albums')
|
7
|
-
FakeWeb.register_uri(:get, "picasaweb.google.com/data/feed/api/user/some.user", :response => page)
|
8
|
-
end
|
9
|
-
|
10
|
-
should 'parse it' do
|
11
|
-
albums = Picasa.albums(:google_user => 'some.user')
|
12
|
-
assert_equal 5, albums.count
|
13
|
-
assert_equal "SAPS in da akcion :P", albums.first[:title]
|
14
|
-
assert_equal 10, albums[2][:photos_count]
|
15
|
-
assert_equal "5277503612406515713", albums.first[:id]
|
16
|
-
assert_not_nil albums.first[:photo]
|
17
|
-
assert_not_nil albums.first[:thumbnail]
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
context 'with photos page' do
|
22
|
-
setup do
|
23
|
-
page = fixture_file('photos')
|
24
|
-
FakeWeb.register_uri(:get, "picasaweb.google.com/data/feed/api/user/some.user/albumid/666", :response => page)
|
25
|
-
end
|
26
|
-
|
27
|
-
should 'parse it' do
|
28
|
-
photos = Picasa.photos(:google_user => 'some.user', :album_id => '666')
|
29
|
-
assert_equal 10, photos[:photos].count
|
30
|
-
assert_not_nil photos[:slideshow]
|
31
|
-
assert_not_nil photos[:photos].first[:thumbnail_1]
|
32
|
-
assert_not_nil photos[:photos].first[:thumbnail_2]
|
33
|
-
assert_not_nil photos[:photos].first[:thumbnail_3]
|
34
|
-
assert_nil photos[:photos].first[:title]
|
35
|
-
assert_equal "http://lh5.ggpht.com/_Kp7xCOU0f_U/SQS8EFqEXjI/AAAAAAAAAFo/aUOA6byXAuE/Jurek.JPG",
|
36
|
-
photos[:photos].first[:photo]
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
should "Raise argument error if google user is not present" do
|
41
|
-
assert_raise ArgumentError do
|
42
|
-
Picasa::WebAlbums.new
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
should "Raise argument error if album_id is not present" do
|
47
|
-
assert_raise ArgumentError do
|
48
|
-
Picasa.photos :google_user => 'some.user'
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
should "Not raise argument error if google user is set by configuration block" do
|
53
|
-
Picasa.config do |c|
|
54
|
-
c.google_user = 'some.user'
|
55
|
-
end
|
56
|
-
assert_nothing_raised do
|
57
|
-
Picasa::WebAlbums.new(nil)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|