Sha256: 9bd72dd5cd3799b1d5f4a01d9c4cd6f25e63f411387b063cb6c300d8ab7ddcac

Contents?: true

Size: 1.45 KB

Versions: 5

Compression:

Stored size: 1.45 KB

Contents

require "embulk/input/marketo_api/soap/base"
require "lead_fixtures"

module Embulk
  module Input
    module MarketoApi
      module Soap
        class BaseTest < Test::Unit::TestCase
          include LeadFixtures

          def test_with_retry
            any_instance_of(Savon::Client) do |klass|
              stub(klass).call(:timeout_test, advanced_typecasting: false) { raise ::Timeout::Error }
            end

            mock(Embulk.logger).warn(/TimeoutError/).times(Base::RETRY_TIMEOUT_COUNT)

            assert_raise(::Timeout::Error) do
              soap.send(:savon_call, :timeout_test)
            end
          end

          class TestSignature < self
            def setup
              @signature = soap.__send__(:signature)
            end

            def test_sigature_keys
              assert_equal(%w(requestTimestamp requestSignature).sort, @signature.keys.sort)
            end

            def test_is_hash
              assert_equal(Hash, @signature.class)
            end
          end

          private

          def soap
            @soap ||= Base.new(settings[:endpoint], settings[:wsdl], settings[:user_id], settings[:encryption_key])
          end

          def settings
            {
              endpoint: "https://marketo.example.com",
              wsdl: "https://marketo.example.com/?wsdl",
              user_id: "user_id",
              encryption_key: "TOPSECRET",
            }
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
embulk-input-marketo-0.3.2 test/embulk/input/marketo_api/soap/test_base.rb
embulk-input-marketo-0.3.1 test/embulk/input/marketo_api/soap/test_base.rb
embulk-input-marketo-0.3.0 test/embulk/input/marketo_api/soap/test_base.rb
embulk-input-marketo-0.2.5 test/embulk/input/marketo_api/soap/test_base.rb
embulk-input-marketo-0.2.4 test/embulk/input/marketo_api/soap/test_base.rb