Sha256: 5c2432492527491db76bbbb200c131f40b2d40bc21a0437f6c066635838d6d47

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 KB

Contents

with_rackup('basic_auth.ru') do
  Shindo.tests('Excon basics (Authorization data redacted)') 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 = Excon.new(url)

      test("authorization header concealed for #{desc}") do
        !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

10 entries across 10 versions & 1 rubygems

Version Path
excon-0.26.0 tests/authorization_header_tests.rb
excon-0.25.3 tests/authorization_header_tests.rb
excon-0.25.2 tests/authorization_header_tests.rb
excon-0.25.1 tests/authorization_header_tests.rb
excon-0.25.0 tests/authorization_header_tests.rb
excon-0.24.0 tests/authorization_header_tests.rb
excon-0.23.0 tests/authorization_header_tests.rb
excon-0.22.1 tests/authorization_header_tests.rb
excon-0.22.0 tests/authorization_header_tests.rb
excon-0.21.0 tests/authorization_header_tests.rb