Sha256: 09541bee2e0a7649a0ceba27f547d872f73745cbb9dd6dac5ee2ebf6d0a42695

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

require "helper"

describe Picasa::Client do
  it "raises ArgumentError when user_id is missing" do
    assert_raises(Picasa::ArgumentError, /user_id/) do
      Picasa::Client.new
    end
  end

  it "allows to assign custom authorization header" do
    client = Picasa::Client.new(:user_id => "john.doe", :authorization_header => "OAuth token")
    assert_equal "OAuth token", client.authorization_header
  end

  describe "#authenticate" do
    it "successfully authenticates" do
      VCR.use_cassette("auth-success") do
        client = Picasa::Client.new(:user_id => "w.wnetrzak@gmail.com", :password => Password)
        client.authenticate

        refute_nil client.authorization_header
      end
    end

    it "raises an ForbiddenError when authentication failed" do
      VCR.use_cassette("auth-failed") do
        client = Picasa::Client.new(:user_id => "w.wnetrzak@gmail.com", :password => "invalid")

        assert_raises(Picasa::ForbiddenError) do
          client.authenticate
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
picasa-0.6.2 test/client_test.rb
picasa-0.6.1 test/client_test.rb
picasa-0.6.0 test/client_test.rb