Permalink
Browse files

Fix parsing GetProductCategoriesForASIN response

The amazon mws GetProductCategoriesForASIN api call
returns multiple <Self> nodes (if available), but
the code returned only the last XML node.
  • Loading branch information...
1 parent 4c806de commit 08d96aa0bd3fc1345bbd2a485ac66e5fec603dd7 @ckrybus ckrybus committed Jan 23, 2014
Showing with 5 additions and 3 deletions.
  1. +1 −1 boto/mws/response.py
  2. +4 −2 tests/integration/mws/test.py
View
@@ -609,7 +609,7 @@ def __init__(self, *args, **kw):
class GetProductCategoriesResult(ResponseElement):
- Self = Element(ProductCategory)
+ Self = ElementList(ProductCategory)
class GetProductCategoriesForSKUResult(GetProductCategoriesResult):
@@ -71,8 +71,10 @@ def test_get_product_categories_for_asin(self):
response = self.mws.get_product_categories_for_asin(
MarketplaceId=self.marketplace_id,
ASIN=asin)
- result = response._result
- self.assertTrue(int(result.Self.ProductCategoryId) == 21)
+ self.assertTrue(len(response._result.Self) == 2)
+ category_ids = lambda x: int(x.ProductCategoryId)
+ category_ids = map(category_ids, response._result.Self)
+ self.assertSequenceEqual(category_ids, [285856, 21])
@unittest.skipUnless(simple and isolator, "skipping simple test")
def test_list_matching_products(self):

0 comments on commit 08d96aa

Please sign in to comment.