Sha256: cbf79c439226fad52cb29778a227e0b8ef4c1721ba17687fca06242e4b764151

Contents?: true

Size: 879 Bytes

Versions: 5

Compression:

Stored size: 879 Bytes

Contents

require 'spec_helper'

describe 'ca-bundle.crt' do

  it 'should be able to connect to the ITRP API' do
    WebMock.allow_net_connect!
    client = Itrp::Client.new(api_token: 'invalid', max_retry_time: -1)
    result = {}

    # no exception concerning the certificate
    expect { result[:response] = client.get('me') }.not_to raise_error
    response = result[:response]
    expect(response.valid?).to be_falsey

    # expecting 401 error
    expect(response.message).to eq('401: Access credentials required')
  end

  it 'should be able to connect to S3' do
    WebMock.allow_net_connect!
    http = Net::HTTP.new('itrp-eu.s3-eu-west-1.amazonaws.com', 443)
    http.read_timeout = 1
    http.use_ssl = true

    # no SSL error please
    expect{ http.start{ |_http| _http.request(Net::HTTP::Get.new('/exports/20141107/')) } }.to never_raise(OpenSSL::SSL::SSLError)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
itrp-client-1.1.5 spec/lib/itrp/certificate_spec.rb
itrp-client-1.1.4 spec/lib/itrp/certificate_spec.rb
itrp-client-1.1.2 spec/lib/itrp/certificate_spec.rb
itrp-client-1.1.1 spec/lib/itrp/certificate_spec.rb
itrp-client-1.1.0 spec/lib/itrp/certificate_spec.rb