Skip to content

Commit ee00ad1

Browse files
committed
test: add test for get_category_by_ids
1 parent f466621 commit ee00ad1

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

tests/test_client.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_search_encoding(self):
110110
def test_get_article(self):
111111
self.client.get_article("p3f2qa")
112112
self.session_mock().get.assert_called_with(
113-
"https://storefront-prod.nl.picnicinternational.com/api/15/pages/product-details-page-root?id=p3f2qa",
113+
"https://storefront-prod.nl.picnicinternational.com/api/15/pages/product-details-page-root?id=p3f2qa&show_category_action=true",
114114
headers=PICNIC_HEADERS,
115115
)
116116

@@ -220,6 +220,30 @@ def test_get_categories(self):
220220
{"type": "CATEGORY", "id": "purchases", "name": "Besteld"},
221221
)
222222

223+
def test_get_category_by_ids(self):
224+
self.session_mock().get.return_value = self.MockResponse(
225+
{"children": [
226+
{
227+
"id": "vertical-article-tiles-sub-header-22193",
228+
"pml": {
229+
"component": {
230+
"accessibilityLabel": "Halvarine"
231+
}
232+
}
233+
}
234+
]},
235+
200
236+
)
237+
238+
category = self.client.get_category_by_ids(1000, 22193)
239+
self.session_mock().get.assert_called_with(
240+
f"{self.expected_base_url}/pages/L2-category-page-root" +
241+
"?category_id=1000&l3_category_id=22193", headers=PICNIC_HEADERS
242+
)
243+
244+
self.assertDictEqual(
245+
category, {"name": "Halvarine", "l2_id": 1000, "l3_id": 22193})
246+
223247
def test_get_auth_exception(self):
224248
self.session_mock().get.return_value = self.MockResponse(
225249
{"error": {"code": "AUTH_ERROR"}}, 400

0 commit comments

Comments
 (0)