Sha256: ba6b72840af1400c6ab27565beb259ba4b3a3cf12a4861b21cf8ca917902bfcf

Contents?: true

Size: 1.48 KB

Versions: 2

Compression:

Stored size: 1.48 KB

Contents

# -*- encoding: utf-8 -*-
require "helper"

describe Picasa::API::Tag do
  describe "#list" do
    it "throws ArgumentError when photo_id provided without album_id" do
      tag = Picasa::API::Tag.new(:user_id => "w.wnetrzak")

      assert_raises Picasa::ArgumentError, /album_id/ do
        tag.list(:photo_id => "12343")
      end
    end

    it "gives correct parsed body fragment" do
      stub_request(:get, "https://picasaweb.google.com/data/feed/api/user/w.wnetrzak?kind=tag").to_return(fixture("tag/tag-list.txt"))

      tag_list = Picasa::API::Tag.new(:user_id => "w.wnetrzak").list

      assert_equal 2, tag_list.entries.size
    end
  end

  describe "#create" do
    it "raises ArgumentError when no album_id" do
      tag = Picasa::API::Tag.new(:user_id => "w.wnetrzak@gmail.com", :password => "secret")
      assert_raises Picasa::ArgumentError, /album_id/ do
        tag.create(:photo_id => "455", :title => "title")
      end
    end

    it "raises ArgumentError when no photo_id" do
      tag = Picasa::API::Tag.new(:user_id => "w.wnetrzak@gmail.com", :password => "secret")
      assert_raises Picasa::ArgumentError, /photo_id/ do
        tag.create(:album_id => "123", :title => "title")
      end
    end

    it "raises ArgumentError when no title" do
      tag = Picasa::API::Tag.new(:user_id => "w.wnetrzak@gmail.com", :password => "secret")
      assert_raises Picasa::ArgumentError, /title/ do
        tag.create(:album_id => "123", :photo_id => "455")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
picasa-0.5.2 test/api/tag_test.rb
picasa-0.5.1 test/api/tag_test.rb