Sha256: 4651d1c9ba7b2343fca63568107c23580dfe0010ba18b38871452027b26de6bd

Contents?: true

Size: 1.44 KB

Versions: 1

Compression:

Stored size: 1.44 KB

Contents

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

class AuthenticatedTest < Test::Unit::TestCase
  include Octopi
  def setup
    fake_everything
  end
  
  context "Authenticating" do
    should "be able to login with github.yml" do
      authenticated :config => File.join(File.dirname(__FILE__), "github.yml") do
        assert_equal "8f700e0d7747826f3e56ee13651414bd", Api.api.token
        assert_not_nil User.find("fcoury")
      end
    end

    should "be possible with username and password" do
      authenticated_with(:login => "fcoury", :password => "yruocf") do
        assert_equal "8f700e0d7747826f3e56ee13651414bd", Api.api.token
        assert_not_nil User.find("fcoury")
      end
    end
        
     should "be possible with username and token" do
       auth do
         assert_not_nil User.find("fcoury")
       end
     end
     
     should "be possible using the .gitconfig" do
       authenticated do
         assert_not_nil User.find("fcoury")
       end
     end
     # 
     # should "be denied access when specifying an invalid token and login combination" do
     #   FakeWeb.clean_registry
     #   FakeWeb.register_uri(:get, "http://github.com/api/v2/yaml/user/show/fcoury", :status => ["404", "Not Found"])
     #   assert_raise InvalidLogin do
     #     authenticated_with :login => "fcoury", :token => "ba7bf2d7f0ebc073d3874dda887b18ae" do
     #       # Just blank will do us fine.
     #     end
     #   end 
     # end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octopi-0.4.5 test/authenticated_test.rb