Sha256: f2d4bf57f142c88e16494bc7111fbca6c95f70f688cf01becd79e46cbe5a3a9f

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 KB

Contents

with_rackup('basic.ru') do
  Shindo.tests('Excon basics') do
    basic_tests
  end

  Shindo.tests('explicit uri passed to connection') do
    connection = Excon::Connection.new({
      :host             => '127.0.0.1',
      :nonblock         => false,
      :port             => 9292,
      :scheme           => 'http',
      :ssl_verify_peer  => false
    })

    tests('GET /content-length/100') do
      response = connection.request(:method => :get, :path => '/content-length/100')

      tests('response[:status]').returns(200) do
        response[:status]
      end
    end
  end
end

with_rackup('basic_auth.ru') do
  Shindo.tests('Excon basics (Basic Auth Pass)') do
    basic_tests('http://test_user:test_password@127.0.0.1:9292')
  end

  Shindo.tests('Excon basics (Basic Auth Fail)') do
    cases = [
      ['correct user, no password', 'http://test_user@127.0.0.1:9292'],
      ['correct user, wrong password', 'http://test_user:fake_password@127.0.0.1:9292'],
      ['wrong user, correct password', 'http://fake_user:test_password@127.0.0.1:9292'],
    ]
    cases.each do |desc,url|
      connection = Excon.new(url)
      response = connection.request(:method => :get, :path => '/content-length/100')

      tests("response.status for #{desc}").returns(401) do
        response.status
      end

    end
  end
end

with_rackup('ssl.ru') do
  Shindo.tests('Excon basics (ssl)') do
    basic_tests('https://127.0.0.1:9443')
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
excon-0.19.1 tests/basic_tests.rb
excon-0.19.0 tests/basic_tests.rb