Sha256: 6d7b112898f273d3bd4ba375df84f09b6f21fa646fc18933a70dbc47b56efc37

Contents?: true

Size: 887 Bytes

Versions: 7

Compression:

Stored size: 887 Bytes

Contents

require 'integration_helper'
require 'mws/orders'
require 'peddler/errors/handler'

class TestErrors < IntegrationTest
  def setup
    @previous_error_handler = MWS::Orders::Client.error_handler
    MWS::Orders::Client.error_handler = Peddler::Errors::Handler
    @api = 'Orders'
    super
  end

  def teardown
    MWS::Orders::Client.error_handler = @previous_error_handler
    super
  end

  def test_invalid_key
    clients.each do |client|
      e = assert_raises Peddler::Errors::Error do
        client.aws_access_key_id = 'foo'
        client.get_order('bar')
      end
      assert_instance_of Peddler::Errors::InvalidAccessKeyId, e
    end
  end

  def test_request_throttled
    clients.each do |client|
      e = assert_raises Peddler::Errors::Error do
        client.get_order('foo')
      end
      assert_instance_of Peddler::Errors::RequestThrottled, e
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
peddler-1.6.3 test/integration/test_errors.rb
peddler-1.6.2 test/integration/test_errors.rb
peddler-1.6.1 test/integration/test_errors.rb
peddler-1.6.0 test/integration/test_errors.rb
peddler-1.5.0 test/integration/test_errors.rb
peddler-1.4.1 test/integration/test_errors.rb
peddler-1.4.0 test/integration/test_errors.rb