Sha256: a1b35c60b92241bf8831e4cc7556947d79e53a188cc89974617cec4915bb9cf4

Contents?: true

Size: 1.07 KB

Versions: 41

Compression:

Stored size: 1.07 KB

Contents

Shindo.tests('Excon basics (Authorization data redacted)') do
  with_rackup('basic_auth.ru') do
    cases = [
      ['user & pass', 'http://user1:pass1@foo.com/', 'Basic dXNlcjE6cGFzczE='],
      ['email & pass', 'http://foo%40bar.com:pass1@foo.com/', 'Basic Zm9vQGJhci5jb206cGFzczE='],
      ['user no pass', 'http://three_user@foo.com/', 'Basic dGhyZWVfdXNlcjo='],
      ['pass no user', 'http://:derppass@foo.com/', 'Basic OmRlcnBwYXNz']
    ]
    cases.each do |desc,url,auth_header|
      conn = nil

      test("authorization header concealed for #{desc}") do
        conn = Excon.new(url)
        !conn.inspect.include?(auth_header)
      end

      test("authorization header remains correct for #{desc}") do
        conn.data[:headers]['Authorization'] == auth_header
      end

      if conn.data[:password]
        test("password param concealed for #{desc}") do
          !conn.inspect.include?(conn.data[:password])
        end
      end

      test("password param remains correct for #{desc}") do
        conn.data[:password] == URI.parse(url).password
      end

    end
  end
end

Version data entries

41 entries across 41 versions & 3 rubygems

Version Path
excon-0.51.0 tests/authorization_header_tests.rb
excon-0.50.1 tests/authorization_header_tests.rb
excon-0.50.0 tests/authorization_header_tests.rb
able-neo4j-1.0.0 vendor/bundle/jruby/1.9/gems/excon-0.45.4/tests/authorization_header_tests.rb
excon-0.49.0 tests/authorization_header_tests.rb
excon-0.48.0 tests/authorization_header_tests.rb
excon-0.47.0 tests/authorization_header_tests.rb
excon-0.46.0 tests/authorization_header_tests.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/excon-0.45.4/tests/authorization_header_tests.rb
excon-0.45.4 tests/authorization_header_tests.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/excon-0.45.3/tests/authorization_header_tests.rb
excon-0.45.3 tests/authorization_header_tests.rb
excon-0.45.2 tests/authorization_header_tests.rb
excon-0.45.1 tests/authorization_header_tests.rb
excon-0.45.0 tests/authorization_header_tests.rb
excon-0.44.4 tests/authorization_header_tests.rb
excon-0.44.3 tests/authorization_header_tests.rb
excon-0.44.2 tests/authorization_header_tests.rb
excon-0.44.1 tests/authorization_header_tests.rb
excon-0.44.0 tests/authorization_header_tests.rb