test/unit/services/webgistix_test.rb in active_fulfillment-0.10.0 vs test/unit/services/webgistix_test.rb in active_fulfillment-1.0.0
- old
+ new
@@ -87,10 +87,20 @@
assert_equal 'No Address Line 1', response.params['error_0']
assert_equal 'Unknown ItemID: testitem', response.params['error_1']
assert_equal 'Unknown ItemID: WX-01-1000', response.params['error_2']
end
+
+ def test_stock_levels
+ @service.expects(:ssl_post).returns(inventory_response)
+
+ response = @service.fetch_stock_levels
+ assert response.success?
+ assert_equal WebgistixService::SUCCESS_MESSAGE, response.message
+ assert_equal 202, response.stock_levels['GN-00-01A']
+ assert_equal 199, response.stock_levels['GN-00-02A']
+ end
def test_failed_login
@service.expects(:ssl_post).returns(invalid_login_response)
response = @service.fulfill('123456', @address, @line_items, @options)
@@ -139,7 +149,14 @@
'<Error>No Address Line 1</Error><Error>Unknown ItemID: testitem</Error><Error>Unknown ItemID: WX-01-1000</Error>'
end
def garbage_response
'<font face="Arial" size=2>/XML/shippingTest.asp</font><font face="Arial" size=2>, line 39</font>'
+ end
+
+ def inventory_response
+ '<InventoryXML>' +
+ '<Item><ItemID>GN-00-01A</ItemID><ItemQty>202</ItemQty></Item>' +
+ '<Item><ItemID>GN-00-02A</ItemID><ItemQty>199</ItemQty></Item>' +
+ '</InventoryXML>'
end
end