Sha256: 33bd41f3c16e581d0a8e55762757248ed711b51fff94eeae84d4b6db27c43c4e

Contents?: true

Size: 1.78 KB

Versions: 5

Compression:

Stored size: 1.78 KB

Contents

require 'helper'
require 'mws/merchant_fulfillment/client'

class TestMWSMerchantFulfillmentClient < MiniTest::Test
  def setup
    @client = MWS::MerchantFulfillment::Client.new
  end

  def test_gets_eligible_shipping_services
    operation = {
      'Action' => 'GetEligibleShippingServices',
      'ShipmentRequestDetails.Id' => '123',
      'ShipmentRequestDetails.Foo.Bar' => 'baz'
    }

    @client.stub(:run, nil) do
      shipment_request_details = {
        id: '123',
        foo: { bar: 'baz' }
      }
      @client.get_eligible_shipping_services(shipment_request_details)
    end

    assert_equal operation, @client.operation
  end

  def test_creates_shipment
    operation = {
      'Action' => 'CreateShipment',
      'ShipmentRequestDetails.Id' => '123',
      'ShipmentRequestDetails.Foo.Bar' => 'baz',
      'ShippingServiceId' => 'FOO'
    }

    @client.stub(:run, nil) do
      shipment_request_details = {
        id: '123',
        foo: { bar: 'baz' }
      }
      @client.create_shipment(shipment_request_details, 'FOO')
    end

    assert_equal operation, @client.operation
  end

  def test_gets_shipment
    operation = {
      'Action' => 'GetShipment',
      'ShipmentId' => '123'
    }

    @client.stub(:run, nil) do
      @client.get_shipment('123')
    end

    assert_equal operation, @client.operation
  end

  def test_cancels_shipment
    operation = {
      'Action' => 'CancelShipment',
      'ShipmentId' => '123'
    }

    @client.stub(:run, nil) do
      @client.cancel_shipment('123')
    end

    assert_equal operation, @client.operation
  end

  def test_gets_service_status
    operation = {
      'Action' => 'GetServiceStatus'
    }

    @client.stub(:run, nil) do
      @client.get_service_status
    end

    assert_equal operation, @client.operation
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
peddler-1.6.0 test/unit/mws/test_merchant_fulfillment_client.rb
peddler-1.5.0 test/unit/mws/test_merchant_fulfillment_client.rb
peddler-1.4.1 test/unit/mws/test_merchant_fulfillment_client.rb
peddler-1.4.0 test/unit/mws/test_merchant_fulfillment_client.rb
peddler-1.3.0 test/unit/mws/test_merchant_fulfillment_client.rb