|
19 | 19 |
|
20 | 20 | class CustomersTestCase(TestCase): |
21 | 21 |
|
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 | + ) |
26 | 29 |
|
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} |
30 | 33 |
|
31 | | - api_get = Mock() |
32 | | - api_get.return_value = customer_response |
| 34 | + api_get = Mock() |
| 35 | + api_get.return_value = customer_response |
33 | 36 |
|
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') |
36 | 39 |
|
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') |
39 | 42 |
|
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} |
44 | 47 |
|
45 | | - api_post = Mock() |
46 | | - api_post.return_value = customer_response |
| 48 | + api_post = Mock() |
| 49 | + api_post.return_value = customer_response |
47 | 50 |
|
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) |
50 | 53 |
|
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