Skip to content

Commit feedb62

Browse files
committed
test: add test for unsupported return data
1 parent 7d41317 commit feedb62

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

tests/test_client.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,35 @@ def test_get_article_with_category(self):
179179
article, {'name': 'Blue Band Goede start halvarine', 'id': 'p3f2qa',
180180
"category": {"l2_id": 2000, "l3_id": 3000, "name": "Test"}})
181181

182+
def test_get_article_with_unsupported_structure(self):
183+
self.session_mock().get.return_value = self.MockResponse(
184+
{"body": {"child": {"child": {"children": [{
185+
"id": "unsupported-root-container",
186+
"pml": {
187+
"component": {
188+
"children": [
189+
{
190+
"markdown": "#(#333333)Goede start halvarine#(#333333)",
191+
},
192+
{
193+
"markdown": "Blue Band",
194+
},
195+
196+
]
197+
}
198+
}
199+
}]}}}},
200+
200
201+
)
202+
203+
article = self.client.get_article("p3f2qa")
204+
self.session_mock().get.assert_called_with(
205+
"https://storefront-prod.nl.picnicinternational.com/api/15/pages/product-details-page-root?id=p3f2qa&show_category_action=true",
206+
headers=PICNIC_HEADERS,
207+
)
208+
209+
assert article is None
210+
182211
def test_get_article_by_gtin(self):
183212
self.client.get_article_by_gtin("123456789")
184213
self.session_mock().get.assert_called_with(

0 commit comments

Comments
 (0)