Skip to content

Commit 39f50ef

Browse files
committed
added testing for /customers
1 parent 76e5092 commit 39f50ef

File tree

1 file changed

+26
-23
lines changed

1 file changed

+26
-23
lines changed

pybutton/test/resources/customers_test.py

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,37 @@
1919

2020
class CustomersTestCase(TestCase):
2121

22-
def test_path(self):
23-
customer = Customers('sk-XXX', config)
24-
self.assertEqual(customer._path(), '/v1/customers')
25-
self.assertEqual(customer._path('customer-1'), '/v1/customers/customer-1')
22+
def test_path(self):
23+
customer = Customers('sk-XXX', config)
24+
self.assertEqual(customer._path(), '/v1/customers')
25+
self.assertEqual(
26+
customer._path('customer-1'),
27+
'/v1/customers/customer-1'
28+
)
2629

27-
def test_get(self):
28-
customer = Customers('sk-XXX', config)
29-
customer_response = {'a': 1}
30+
def test_get(self):
31+
customer = Customers('sk-XXX', config)
32+
customer_response = {'a': 1}
3033

31-
api_get = Mock()
32-
api_get.return_value = customer_response
34+
api_get = Mock()
35+
api_get.return_value = customer_response
3336

34-
with patch.object(customer, 'api_get', api_get):
35-
response = customer.get('customer-XXX')
37+
with patch.object(customer, 'api_get', api_get):
38+
response = customer.get('customer-XXX')
3639

37-
self.assertEqual(response, customer_response)
38-
api_get.assert_called_with('/v1/customers/customer-XXX')
40+
self.assertEqual(response, customer_response)
41+
api_get.assert_called_with('/v1/customers/customer-XXX')
3942

40-
def test_create(self):
41-
customer = Customers('sk-XXX', config)
42-
customer_payload = {'b': 2}
43-
customer_response = {'a': 1}
43+
def test_create(self):
44+
customer = Customers('sk-XXX', config)
45+
customer_payload = {'b': 2}
46+
customer_response = {'a': 1}
4447

45-
api_post = Mock()
46-
api_post.return_value = customer_response
48+
api_post = Mock()
49+
api_post.return_value = customer_response
4750

48-
with patch.object(customer, 'api_post', api_post):
49-
response = customer.create(customer_payload)
51+
with patch.object(customer, 'api_post', api_post):
52+
response = customer.create(customer_payload)
5053

51-
self.assertEqual(response, customer_response)
52-
api_post.assert_called_with('/v1/customers', customer_payload)
54+
self.assertEqual(response, customer_response)
55+
api_post.assert_called_with('/v1/customers', customer_payload)

0 commit comments

Comments
 (0)