0
@@ -231,7 +231,7 @@ class TestFlickr < Test::Unit::TestCase
0
assert_kind_of Flickr::Group, group = groups.first
0
assert_equal "group1", group.id
0
assert_equal "Group One", group.name
0
- assert_equal "0", group.
instance_variable_get(:@eighteenplus)0
+ assert_equal "0", group.
eighteenplus0
assert_equal f, group.client
0
@@ -269,11 +269,7 @@ class TestFlickr < Test::Unit::TestCase
0
# ##### Flickr::User tests
0
def test_should_instantiate_user
0
- user = Flickr::User.new({ 'id' => 'foo123',
0
- 'username' => 'some_user',
0
- 'name' => 'Some User',
0
- 'auth_token' => 'foobar789'})
0
assert_equal 'foo123', user.id
0
assert_equal 'some_user', user.username
0
assert_equal 'bar', user.instance_variable_get(:@foo) # should collect all other params up and store as instance variables
0
@@ -296,48 +292,41 @@ class TestFlickr < Test::Unit::TestCase
0
def test_should_instantiate_new_client_when_instantiating_user_if_no_client_passed_in_params
0
Flickr.expects(:new).returns(f)
0
- user = Flickr::User.new({ 'id' => 'foo123',
0
- 'username' => 'some_user',
0
- 'name' => 'Some User',
0
- 'auth_token' => 'foobar789',
0
- 'shared_secret' => 'some_secret',
0
- 'api_key' => 'an_api_key' })
0
+ user = new_user( 'api_key' => 'an_api_key' )
0
assert_equal f, user.client
0
def test_should_not_instantiate_new_client_when_instantiating_user_if_client_passed_in_params
0
Flickr.expects(:new).never
0
- user = Flickr::User.new({ 'id' => 'foo123',
0
- 'username' => 'some_user',
0
- 'name' => 'Some User',
0
+ user = new_user( 'client' => f )
0
assert_equal f, user.client
0
- def test_should_not_instantiate_new_client_if_existing_client_passed
0
+ def test_should_not_instantiate_client_if_no_api_key_passed
0
Flickr.expects(:new).never
0
- user = Flickr::User.new({ 'id' => 'foo123',
0
- 'username' => 'some_user',
0
- 'name' => 'Some User',
0
- 'api_key' => 'an_api_key',
0
- assert_equal f, user.client
0
+ assert_nil user.client
0
- def test_should_not_instantiate_client_if_no_api_key_passed
0
- user = Flickr::User.new({ 'id' => 'foo123',
0
- 'username' => 'some_user',
0
- 'name' => 'Some User'})
0
- assert_nil user.client
0
+ def test_should_get_users_public_groups
0
+ f.expects(:request).with("people.getPublicGroups", anything).returns(dummy_groups_response)
0
+ new_user( 'client' => f ).groups
0
- def test_should_
not_instantiate_new_client_when_instantiating_user_if_existing_client_passed_to_user_as_param0
+ def test_should_
instantiate_users_public_groups0
- Flickr.expects(:new).never
0
- user = Flickr::User.new('client' => f)
0
- assert_equal f, user.client
0
+ f.stubs(:request).returns(dummy_groups_response)
0
+ user = new_user( 'client' => f )
0
+ assert_equal 2, groups.size
0
+ assert_kind_of Flickr::Group, group = groups.first
0
+ assert_equal "group1", group.id
0
+ assert_equal "Group One", group.name
0
+ assert_equal "0", group.eighteenplus
0
+ assert_equal f, group.client
0
@@ -631,9 +620,10 @@ class TestFlickr < Test::Unit::TestCase
0
# new api for instantiating groups
0
def test_should_instantiate_group_from_params_hash
0
- group = Flickr::Group.new("id" => "group1", "name" => "Group One", "
foo" => "bar")
0
+ group = Flickr::Group.new("id" => "group1", "name" => "Group One", "
eighteenplus" => "1", "foo" => "bar")
0
assert_equal "group1", group.id
0
assert_equal "Group One", group.name
0
+ assert_equal "1", group.eighteenplus
0
assert_equal "bar", group.instance_variable_get(:@foo)
0
@@ -644,6 +634,14 @@ class TestFlickr < Test::Unit::TestCase
0
assert_equal f, group.client
0
+ def test_should_provide_id_name_eighteenplus_description_members_online_privacy_reader_methods_for_group
0
+ %w(id name eighteenplus description members online privacy).each do |m|
0
+ g.instance_variable_set("@#{m}", "foo_#{m}")
0
+ assert_equal "foo_#{m}", g.send(m)
0
# def test_should_initialize_photo_from_id
0
# photo = Flickr::Photo.new("foo123")
0
# assert_equal "foo123", photo.id
0
@@ -719,6 +717,14 @@ class TestFlickr < Test::Unit::TestCase
0
+ def new_user(options={})
0
+ Flickr::User.new({ 'id' => 'foo123',
0
+ 'username' => 'some_user',
0
+ 'name' => 'Some User',
0
+ 'auth_token' => 'foobar789'}.merge(options))
0
def new_photo(options={})
0
Flickr::Photo.new("1418878",
Comments
No one has commented yet.