Sha256: df9e18bf30f8d382eed27cfecd5208b3ff54e7dacdf5013f3389dea784b1598c

Contents?: true

Size: 1.26 KB

Versions: 3

Compression:

Stored size: 1.26 KB

Contents

require 'test_helper'
require 'json'

class HttpTest < Test::Unit::TestCase
  include TestHelper

  def setup
    @application = Xeroizer::PrivateApplication.new(CONSUMER_KEY, CONSUMER_SECRET, PRIVATE_KEY_PATH, {:xero_url => 'https://api-tls.xero.com/', :site => 'https://api-tls.xero.com/'})
    @applicationExternal = Xeroizer::PrivateApplication.new(CONSUMER_KEY, CONSUMER_SECRET, PRIVATE_KEY_PATH, {:xero_url => 'https://www.howsmyssl.com', :site => 'https://www.howsmyssl.com'})
  end

  context "Connect to Xero TLS 1.2 Test endpoint" do
    should "receive a 301 response (endpoint redirects on success)" do
      begin
        @application.http_get(@application.client, "https://api-tls.xero.com/")
      rescue Xeroizer::Http::BadResponse => e
        assert_equal "Unknown response code: 301", e.message, "Unexpected Response Code (Xero): Check TLS 1.2 is set"
      end
      
    end
  end

  context "Connect to external TLS 1.2 Test endpoint" do
    should "respond with tls version 1.2" do
      response = @applicationExternal.http_get(@applicationExternal.client, "https://www.howsmyssl.com/a/check")
      jsonResponse = JSON.parse(response)
      assert_equal "TLS 1.2", jsonResponse['tls_version'], "Unexpected Response (External): Check TLS 1.2 is set"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
xeroizer-2.20.0 test/unit/http_tsl_12_upgrade_test.rb
xeroizer-2.19.0 test/unit/http_tsl_12_upgrade_test.rb
xeroizer-2.18.1 test/unit/http_tsl_12_upgrade_test.rb