Sha256: cca2249d1d5ca2d72a3c3e4b1e0f5d7d685a198289c15b213c08897c344250ff

Contents?: true

Size: 1.87 KB

Versions: 1

Compression:

Stored size: 1.87 KB

Contents

require 'test_helper'
require 'mws/orders/client'

class TestOrdersClient < MiniTest::Test
  def setup
    @client = MWS::Orders::Client.new
  end

  def test_lists_orders
    operation = {
      'Action' => 'ListOrders',
      'OrderStatus.Status.1' => '1',
      'MarketplaceId.Id.1' => '1',
      'PaymentMethod.1' => '1',
      'TFMShipmentStatus.Status.1' => '1'
    }

    @client.stub(:run, nil) do
      @client.list_orders(
        marketplace_id: '1',
        order_status: '1',
        tfm_shipment_status: '1',
        payment_method: '1'
      )
    end

    assert_equal operation, @client.operation
  end

  def test_lists_orders_by_next_token
    operation = {
      'Action' => 'ListOrdersByNextToken',
      'NextToken' => '1'
    }

    @client.stub(:run, nil) do
      @client.list_orders_by_next_token('1')
    end

    assert_equal operation, @client.operation
  end

  def test_gets_order
    operation = {
      'Action' => 'GetOrder',
      'AmazonOrderId.Id.1' => '1',
      'AmazonOrderId.Id.2' => '2'
    }

    @client.stub(:run, nil) do
      @client.get_order('1', '2')
    end

    assert_equal operation, @client.operation
  end

  def test_lists_order_items
    operation = {
      'Action' => 'ListOrderItems',
      'AmazonOrderId' => '1'
    }

    @client.stub(:run, nil) do
      @client.list_order_items('1')
    end

    assert_equal operation, @client.operation
  end

  def test_lists_order_items_by_next_token
    operation = {
      'Action' => 'ListOrderItemsByNextToken',
      'NextToken' => '1'
    }

    @client.stub(:run, nil) do
      @client.list_order_items_by_next_token('1')
    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

1 entries across 1 versions & 1 rubygems

Version Path
peddler-0.12.5 test/unit/mws/test_orders_client.rb