|
1 | | -# from datetime import datetime, timedelta |
2 | | -# |
3 | | -# from sp_api.api import FulfillmentInbound |
4 | | -# |
5 | | -# def test_get_shipments(): |
6 | | -# r = FulfillmentInbound().get_shipments(QueryType='DATE_RANGE', LastUpdatedAfter=(datetime.now() - timedelta(days=30)).isoformat(), LastUpdatedBefore=datetime.now().isoformat(), ShipmentStatusList=','.join([ |
7 | | -# 'WORKING','SHIPPED','RECEIVING','CANCELLED','DELETED','CLOSED','ERROR','IN_TRANSIT','DELIVERED','CHECKED_IN' |
8 | | -# ])) |
9 | | -# print(r) |
| 1 | +from datetime import datetime, timedelta |
| 2 | + |
| 3 | +from sp_api.api import FulfillmentInbound |
| 4 | + |
| 5 | + |
| 6 | +def test_item_guidance(): |
| 7 | + res = FulfillmentInbound().item_guidance(SellerSKUList=','.join(["sku1", "sku2"]), MarketplaceId='MarketplaceId') |
| 8 | + assert res.errors is None |
| 9 | + |
| 10 | + |
| 11 | +def test_plans(): |
| 12 | + res = FulfillmentInbound().plans(**{ |
| 13 | + "ShipFromAddress": { |
| 14 | + "Name": "Name", |
| 15 | + "AddressLine1": "123 any st", |
| 16 | + "AddressLine2": "AddressLine2", |
| 17 | + "DistrictOrCounty": "Washtenaw", |
| 18 | + "City": "Ann Arbor", |
| 19 | + "StateOrProvinceCode": "MI", |
| 20 | + "CountryCode": "US", |
| 21 | + "PostalCode": "48188" |
| 22 | + }, |
| 23 | + "LabelPrepPreference": "SELLER_LABEL", |
| 24 | + "ShipToCountryCode": "ShipToCountryCode", |
| 25 | + "ShipToCountrySubdivisionCode": "ShipToCountrySubdivisionCode", |
| 26 | + "InboundShipmentPlanRequestItems": [ |
| 27 | + { |
| 28 | + "SellerSKU": "SellerSKU", |
| 29 | + "ASIN": "ASIN", |
| 30 | + "Condition": "NewItem", |
| 31 | + "Quantity": 1, |
| 32 | + "QuantityInCase": 1, |
| 33 | + "PrepDetailsList": [ |
| 34 | + { |
| 35 | + "PrepInstruction": "Polybagging", |
| 36 | + "PrepOwner": "AMAZON" |
| 37 | + } |
| 38 | + ] |
| 39 | + } |
| 40 | + ] |
| 41 | + }) |
| 42 | + assert res.errors is None |
| 43 | + |
| 44 | + |
| 45 | +def test_create_inbound_shipment(): |
| 46 | + res = FulfillmentInbound().create_shipment('123', **{ |
| 47 | + "InboundShipmentHeader": { |
| 48 | + "ShipmentName": "43545345", |
| 49 | + "ShipFromAddress": { |
| 50 | + "Name": "35435345", |
| 51 | + "AddressLine1": "123 any st", |
| 52 | + "DistrictOrCounty": "Washtenaw", |
| 53 | + "City": "Ann Arbor", |
| 54 | + "StateOrProvinceCode": "Test", |
| 55 | + "CountryCode": "US", |
| 56 | + "PostalCode": "48103" |
| 57 | + }, |
| 58 | + "DestinationFulfillmentCenterId": "AEB2", |
| 59 | + "AreCasesRequired": True, |
| 60 | + "ShipmentStatus": "WORKING", |
| 61 | + "LabelPrepPreference": "SELLER_LABEL", |
| 62 | + "IntendedBoxContentsSource": "NONE" |
| 63 | + }, |
| 64 | + "InboundShipmentItems": [ |
| 65 | + { |
| 66 | + "ShipmentId": "345453", |
| 67 | + "SellerSKU": "34534545", |
| 68 | + "FulfillmentNetworkSKU": "435435435", |
| 69 | + "QuantityShipped": 0, |
| 70 | + "QuantityReceived": 0, |
| 71 | + "QuantityInCase": 0, |
| 72 | + "ReleaseDate": "2020-04-23", |
| 73 | + "PrepDetailsList": [ |
| 74 | + { |
| 75 | + "PrepInstruction": "Polybagging", |
| 76 | + "PrepOwner": "AMAZON" |
| 77 | + } |
| 78 | + ] |
| 79 | + } |
| 80 | + ], |
| 81 | + "MarketplaceId": "MarketplaceId" |
| 82 | + }) |
| 83 | + assert res.errors is None |
| 84 | + |
| 85 | + |
| 86 | +def test_update_shipment(): |
| 87 | + res = FulfillmentInbound().update_shipment('123', **{ |
| 88 | + "MarketplaceId": "ATVPDKIKX0DER", |
| 89 | + "InboundShipmentHeader": { |
| 90 | + "ShipmentName": "Shipment for FBA15DJCQ1ZF", |
| 91 | + "ShipFromAddress": { |
| 92 | + "Name": "Uma Test", |
| 93 | + "AddressLine1": "123 any st", |
| 94 | + "AddressLine2": "", |
| 95 | + "DistrictOrCounty": "Washtenaw", |
| 96 | + "City": "Ann Arbor", |
| 97 | + "StateOrProvinceCode": "CO", |
| 98 | + "CountryCode": "US", |
| 99 | + "PostalCode": "48104" |
| 100 | + }, |
| 101 | + "DestinationFulfillmentCenterId": "ABE2", |
| 102 | + "ShipmentStatus": "WORKING", |
| 103 | + "LabelPrepPreference": "SELLER_LABEL" |
| 104 | + }, |
| 105 | + "InboundShipmentItems": [ |
| 106 | + { |
| 107 | + "SellerSKU": "PSMM-TEST-SKU-Apr-03_21_17_20-0379", |
| 108 | + "QuantityShipped": 1 |
| 109 | + } |
| 110 | + ] |
| 111 | + }) |
| 112 | + assert res.errors is None |
| 113 | + |
| 114 | + |
| 115 | +def test_preorder(): |
| 116 | + res = FulfillmentInbound().preorder('shipmentId1', MarketplaceId='MarketplaceId1') |
| 117 | + assert res.errors is None |
| 118 | + |
| 119 | + |
| 120 | +def test_confirm_preorder(): |
| 121 | + res = FulfillmentInbound().confirm_preorder('shipmentId1', **{ |
| 122 | + "NeedByDate": "2020-10-10", |
| 123 | + "MarketplaceId": "MarketplaceId1" |
| 124 | + }) |
| 125 | + assert res.errors is None |
| 126 | + |
| 127 | + |
| 128 | +def test_get_prep_orders(): |
| 129 | + res = FulfillmentInbound().prep_instruction(**{"ShipToCountryCode": "US", "ASINList": ["ASIN1"]}) |
| 130 | + assert res.errors is None |
| 131 | + |
| 132 | + |
| 133 | +def test_get_transport(): |
| 134 | + res = FulfillmentInbound().get_transport_information('shipmentId1') |
| 135 | + assert res.errors is None |
| 136 | + |
| 137 | + |
| 138 | +def test_void_transport(): |
| 139 | + res = FulfillmentInbound().void_transport('shipmentId1') |
| 140 | + assert res.errors is None |
| 141 | + |
| 142 | + |
| 143 | +def test_estimate_transport(): |
| 144 | + res = FulfillmentInbound().estimate_transport('shipmentId1') |
| 145 | + assert res.errors is None |
| 146 | + |
| 147 | + |
| 148 | +def test_get_bill_of_lading(): |
| 149 | + res = FulfillmentInbound().bill_of_lading('shipmentId') |
| 150 | + assert res.errors is None |
| 151 | + |
| 152 | + |
| 153 | +def test_get_shipments(): |
| 154 | + res = FulfillmentInbound().get_shipments(QueryType='SHIPMENT') |
| 155 | + assert res.errors is None |
| 156 | + |
| 157 | + |
| 158 | +def test_get_shipment_items(): |
| 159 | + res = FulfillmentInbound().shipment_items_by_shipment('FBA15DJ9SVVD') |
| 160 | + assert res.errors is None |
| 161 | + |
| 162 | + |
| 163 | +def test_get_items(): |
| 164 | + res = FulfillmentInbound().shipment_items(QueryType='SHIPMENT', NextToken='NextToken') |
| 165 | + assert res.errors is None |
0 commit comments