forked from square/square-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_catalog_api.py
More file actions
55 lines (41 loc) · 2.15 KB
/
test_catalog_api.py
File metadata and controls
55 lines (41 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
from tests.test_helper import TestHelper
from tests.api.api_test_base import ApiTestBase
class CatalogApiTests(ApiTestBase):
@classmethod
def setUpClass(cls):
super(CatalogApiTests, cls).setUpClass()
cls.controller = cls.client.catalog
cls.response_catcher = cls.controller.http_call_back
# Returns information about the Square Catalog API, such as batch size
#limits for `BatchUpsertCatalogObjects`.
def test_test_catalog_info(self):
# Perform the API call through the SDK function
result = self.controller.catalog_info()
# Test response code
self.assertEquals(self.response_catcher.response.status_code, 200)
# Test headers
expected_headers = {}
expected_headers['content-type'] = 'application/json'
self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))
# Returns a list of [CatalogObject](#type-catalogobject)s that includes
#all objects of a set of desired types (for example, all [CatalogItem](#type-catalogitem)
#and [CatalogTax](#type-catalogtax) objects) in the catalog. The `types` parameter
#is specified as a comma-separated list of valid [CatalogObject](#type-catalogobject) types:
#`ITEM`, `ITEM_VARIATION`, `MODIFIER`, `MODIFIER_LIST`, `CATEGORY`, `DISCOUNT`, `TAX`.
#
#__Important:__ ListCatalog does not return deleted catalog items. To retrieve
#deleted catalog items, use SearchCatalogObjects and set `include_deleted_objects`
#to `true`.
def test_test_list_catalog(self):
# Parameters for the API call
cursor = None
types = None
# Perform the API call through the SDK function
result = self.controller.list_catalog(cursor, types)
# Test response code
self.assertEquals(self.response_catcher.response.status_code, 200)
# Test headers
expected_headers = {}
expected_headers['content-type'] = 'application/json'
self.assertTrue(TestHelper.match_headers(expected_headers, self.response_catcher.response.headers))