assigned_fulfillment_order_test.rb 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. require 'test_helper'
  2. class AssignedFulFillmentOrderTest < Test::Unit::TestCase
  3. context "AssignedFulfillmentOrder" do
  4. context "#all" do
  5. should "list assigned fulfillment orders by assigned_status" do
  6. fulfillment_order_fixture = load_fixture('assigned_fulfillment_orders')
  7. fake 'assigned_fulfillment_orders.json?assigned_status=cancellation_requested', method: :get,
  8. body: fulfillment_order_fixture, extension: false
  9. assigned_fulfillment_orders = ShopifyAPI::AssignedFulfillmentOrder.all(
  10. params: { assigned_status: 'cancellation_requested' }
  11. )
  12. assert_equal 2, assigned_fulfillment_orders.count
  13. assigned_fulfillment_orders.each do |fulfillment_order|
  14. assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
  15. assert_equal 'in_progress', fulfillment_order.status
  16. assert_equal 'cancellation_accepted', fulfillment_order.request_status
  17. end
  18. end
  19. should "be able to list assigned fulfillment orders by location_ids" do
  20. fulfillment_order_fixture = load_fixture('assigned_fulfillment_orders')
  21. assigned_location_id = 905684977
  22. fake "assigned_fulfillment_orders.json?location_ids%5B%5D=#{assigned_location_id}", method: :get,
  23. body: fulfillment_order_fixture, extension: false
  24. assigned_fulfillment_orders = ShopifyAPI::AssignedFulfillmentOrder.all(
  25. params: { location_ids: [assigned_location_id] }
  26. )
  27. assert_equal 2, assigned_fulfillment_orders.count
  28. assigned_fulfillment_orders.each do |fulfillment_order|
  29. assert fulfillment_order.is_a?(ShopifyAPI::FulfillmentOrder)
  30. assert_equal assigned_location_id, fulfillment_order.assigned_location_id
  31. end
  32. end
  33. end
  34. end
  35. end