|
3 | 3 | from pyactiveresource.activeresource import ActiveResource
|
4 | 4 |
|
5 | 5 | class FulFillmentTest(TestCase):
|
6 |
| - |
| 6 | + |
7 | 7 | def setUp(self):
|
8 | 8 | super(FulFillmentTest, self).setUp()
|
9 | 9 | self.fake("orders/450789469/fulfillments/255858046", method='GET', body=self.load_fixture('fulfillment'))
|
@@ -40,3 +40,24 @@ def test_able_to_cancel_fulfillment(self):
|
40 | 40 | self.assertEqual('pending', fulfillment.status)
|
41 | 41 | fulfillment.cancel()
|
42 | 42 | self.assertEqual('cancelled', fulfillment.status)
|
| 43 | + |
| 44 | + def test_update_tracking(self): |
| 45 | + fulfillment = shopify.Fulfillment.find(255858046, order_id=450789469) |
| 46 | + |
| 47 | + tracking_info = { "number": 1111, "url": "http://www.my-url.com", "company": "my-company"} |
| 48 | + notify_customer = False |
| 49 | + |
| 50 | + update_tracking = self.load_fixture('fulfillment') |
| 51 | + update_tracking = update_tracking.replace(b'null-company', b'my-company') |
| 52 | + update_tracking = update_tracking.replace(b'http://www.google.com/search?q=1Z2345', b'http://www.my-url.com') |
| 53 | + update_tracking = update_tracking.replace(b'1Z2345', b'1111') |
| 54 | + |
| 55 | + self.fake("fulfillments/255858046/update_tracking", method="POST", headers={'Content-type': 'application/json'}, body=update_tracking) |
| 56 | + |
| 57 | + self.assertEqual("null-company", fulfillment.tracking_company) |
| 58 | + self.assertEqual("1Z2345", fulfillment.tracking_number) |
| 59 | + self.assertEqual("http://www.google.com/search?q=1Z2345", fulfillment.tracking_url) |
| 60 | + fulfillment.update_tracking(tracking_info, notify_customer) |
| 61 | + self.assertEqual("my-company", fulfillment.tracking_company) |
| 62 | + self.assertEqual('1111', fulfillment.tracking_number) |
| 63 | + self.assertEqual('http://www.my-url.com', fulfillment.tracking_url) |
0 commit comments