Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bigcommerce/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@
from .shipping import *
from .store import *
from .tax_classes import *
from .time import *
from .time import *
from .webhooks import *
10 changes: 10 additions & 0 deletions bigcommerce/resources/webhooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from .base import *


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, would you mind removing the extra line?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could but, I think it would be a style violation. When I remove it and run pep8 against the file:

➤ pep8 bigcommerce/resources/webhooks.py
bigcommerce/resources/webhooks.py:3:1: E302 expected 2 blank lines, found 1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, then leave it.

class Webhooks(ListableApiResource, CreateableApiResource,
UpdateableApiResource, DeleteableApiResource):
resource_name = 'hooks'

@classmethod
def delete_all(self, connection=None):
raise NotImplementedError("The webhook resource does not have delete_all endpoint")
9 changes: 8 additions & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest
from bigcommerce.resources import Mapping, Orders, ApiResource, OrderShipments
from bigcommerce.resources.orders import OrderCoupons
from bigcommerce.resources.webhooks import Webhooks
from mock import MagicMock


Expand Down Expand Up @@ -167,4 +168,10 @@ def test_delete(self):
shipment = OrderShipments({'id': 1, 'order_id': 2, '_connection': connection})
self.assertEqual(shipment.delete(), {})

connection.make_request.assert_called_once_with('DELETE', 'orders/2/shipments/1', None, {}, {})
connection.make_request.assert_called_once_with('DELETE', 'orders/2/shipments/1', None, {}, {})

def test_webhook_delete_all(self):
connection = MagicMock()
connection.make_request.return_value = {}

self.assertRaises(NotImplementedError, Webhooks.delete_all, connection=connection)