Skip to content

Commit

Permalink
Merge pull request #159 from josefdlange/master
Browse files Browse the repository at this point in the history
Added open method to Fulfillment (and appropriate test case)
  • Loading branch information
jamiemtdwyer committed Oct 4, 2016
2 parents 1307405 + a898b7b commit f6632a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shopify/resources/fulfillment.py
Expand Up @@ -9,3 +9,6 @@ def cancel(self):

def complete(self):
self._load_attributes_from_response(self.post("complete"))

def open(self):
self._load_attributes_from_response(self.post("open"))
11 changes: 11 additions & 0 deletions test/fulfillment_test.py
Expand Up @@ -8,6 +8,17 @@ def setUp(self):
super(FulFillmentTest, self).setUp()
self.fake("orders/450789469/fulfillments/255858046", method='GET', body=self.load_fixture('fulfillment'))

def test_able_to_open_fulfillment(self):
fulfillment = shopify.Fulfillment.find(255858046, order_id=450789469)

success = self.load_fixture('fulfillment')
success = success.replace(b'pending',b'open')
self.fake("orders/450789469/fulfillments/255858046/open", method='POST', headers={'Content-length':'0', 'Content-type': 'application/json'}, body=success)

self.assertEqual('pending', fulfillment.status)
fulfillment.open()
self.assertEqual('open', fulfillment.status)

def test_able_to_complete_fulfillment(self):
fulfillment = shopify.Fulfillment.find(255858046, order_id=450789469)

Expand Down

0 comments on commit f6632a3

Please sign in to comment.