Sha256: 09c323c2be40c8249033568b23dca09653ceaece350d4dd47e975ba870c014c8

Contents?: true

Size: 1.28 KB

Versions: 19

Compression:

Stored size: 1.28 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class AuthenticatedTest < Test::Unit::TestCase
  include Octopi
  
  def setup
    fake_everything
    @user = User.find("fcoury")
  end

  context "following" do  
  
    should "not be able to follow anyone if not authenticated" do
      exception = assert_raise AuthenticationRequired do
        Api.me.follow!("rails")
      end
    end
    
    should "be able to follow a user" do
      auth do
        assert_not_nil Api.me.follow!("rails")
      end
    end
  end
  
  context "unfollowing" do  
  
    should "not be able to follow anyone if not authenticated" do
      exception = assert_raise AuthenticationRequired do
        Api.me.unfollow!("rails")
      end
    end
    
    should "be able to follow a user" do
      auth do
        assert_not_nil Api.me.unfollow!("rails")
      end
    end
  end
  
  context "keys" do
    should "not be able to see keys if not authenticated" do
      exception = assert_raise AuthenticationRequired do
        Api.me.keys
      end
   
      assert_equal "To view keys, you must be authenticated", exception.message
    end
   
    should "have some keys" do
      auth do
        keys = Api.me.keys
        assert keys.is_a?(KeySet)
        assert_equal 2, keys.size
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 4 rubygems

Version Path
octopi-0.4.5 test/api_test.rb
octopi-0.4.4 test/api_test.rb
octopi-0.4.2 test/api_test.rb
octopi-0.4.1 test/api_test.rb
octopi-0.4.0 test/api_test.rb
octopi-0.3.0 test/api_test.rb
dcuddeback-octopi-0.2.12 test/api_test.rb
dcuddeback-octopi-0.2.11 test/api_test.rb
dcuddeback-octopi-0.2.9 test/api_test.rb
dcuddeback-octopi-0.2.8 test/api_test.rb
tpitale-octopi-0.3.0 test/api_test.rb
octopi-0.2.8 test/api_test.rb
devver-octopi-0.2.8 test/api_test.rb
octopi-0.2.7 test/api_test.rb
octopi-0.2.6 test/api_test.rb
octopi-0.2.5 test/api_test.rb
octopi-0.2.4 test/api_test.rb
octopi-0.2.2 test/api_test.rb
octopi-0.2.1 test/api_test.rb