Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improved inventory multipage test to ensure that ssl_post

is being called with correct parameters.
  • Loading branch information...
commit 59768c5684ac2167e833b3160ac2016d9139cdd9 1 parent ede329f
@csaunders csaunders authored
Showing with 8 additions and 4 deletions.
  1. +8 −4 test/unit/services/amazon_mws_test.rb
View
12 test/unit/services/amazon_mws_test.rb
@@ -188,13 +188,17 @@ def test_get_inventory
end
def test_get_inventory_multipage
- @service.expects(:ssl_post).twice.returns(
- xml_fixture('amazon_mws/inventory_list_inventory_supply_by_next_token'),
- xml_fixture('amazon_mws/inventory_list_inventory_supply')
- )
+ @service.expects(:ssl_post).with() { |uri, query, headers|
+ query.include?('ListInventorySupply') && !query.include?('ListInventorySupplyByNextToken')
+ }.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply_by_next_token'))
+
+ @service.expects(:ssl_post).with() { |uri, query, headers|
+ query.include?('ListInventorySupplyByNextToken') && query.include?('NextToken')
+ }.returns(xml_fixture('amazon_mws/inventory_list_inventory_supply'))
response = @service.fetch_stock_levels
assert response.success?
+
assert_equal 202, response.stock_levels['GN-00-01A']
assert_equal 199, response.stock_levels['GN-00-02A']
assert_equal 0, response.stock_levels['GN-01-01A']
Please sign in to comment.
Something went wrong with that request. Please try again.