Sha256: 0b9ea9fed899312ed2916e845411d27f7449d45d3c6081621ecf5b11b4d97499

Contents?: true

Size: 1.25 KB

Versions: 6

Compression:

Stored size: 1.25 KB

Contents

require 'yaml'
require 'vcr'
require 'test_helper'

class IntegrationTest < MiniTest::Test
  ACCOUNTS = YAML.load_file(File.expand_path('../mws.yml', __FILE__))

  def api_name
    self.class.name.match(/Test(.*)/)[1]
  end

  def clients
    ACCOUNTS.map do |account|
      MWS.const_get(api_name).const_get(:Client).new(account)
    end
  end

  def setup
    ENV['LIVE'] ? VCR.turn_off! : VCR.insert_cassette(api_name)
  end

  def teardown
    VCR.eject_cassette if VCR.turned_on?
  end
end

VCR.configure do |c|
  c.hook_into :excon
  c.cassette_library_dir = 'test/vcr_cassettes'

  c.before_record do |interaction|
    interaction.ignore! if interaction.response.status.code >= 400
  end

  matcher = VCR.request_matchers.uri_without_param(
    'AWSAccessKeyId', 'SellerId', 'Signature', 'Timestamp', 'StartDate',
    'CreatedAfter', 'QueryStartDateTime'
  )
  c.default_cassette_options = {
    match_requests_on: [:method, matcher],
    record: :none
  }

  IntegrationTest::ACCOUNTS.each do |account|
    c.filter_sensitive_data('MERCHANT_ID') { account.fetch('merchant_id') }
    c.filter_sensitive_data('AWS_SECRET_ACCESS_KEY') { account.fetch('aws_secret_access_key') }
    c.filter_sensitive_data('AWS_ACCESS_KEY_ID') { account.fetch('aws_access_key_id') }
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
peddler-0.11.1 test/integration_test_helper.rb
peddler-0.11.0 test/integration_test_helper.rb
peddler-0.10.0 test/integration_test_helper.rb
peddler-0.9.2 test/integration_test_helper.rb
peddler-0.9.1 test/integration_test_helper.rb
peddler-0.9.0 test/integration_test_helper.rb