Sha256: 41e85b8e785e47975639f599a7a55fc5e6fbba01051a0bb430cda6f613237271

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 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 = 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.30.0 tests/authorization_header_tests.rb
excon-0.29.0 tests/authorization_header_tests.rb
excon-0.28.0 tests/authorization_header_tests.rb
excon-0.27.6 tests/authorization_header_tests.rb
excon-0.27.5 tests/authorization_header_tests.rb
excon-0.27.4 tests/authorization_header_tests.rb
excon-0.27.3 tests/authorization_header_tests.rb
excon-0.27.2 tests/authorization_header_tests.rb
excon-0.27.1 tests/authorization_header_tests.rb
excon-0.27.0 tests/authorization_header_tests.rb