def runTest(self):
     iprot = MagentoXmlrpcProtocol(self.PRODUCTS_XMLRPC)
     products = []
     for _ in xrange(iprot.readListBegin()[1]):
         product = MagentoProduct.read(iprot)
         assert product is not None
         products.append(product)
     iprot.readListEnd()
     assert_that(products, has_length(1))
    def __init__(self, *args, **kwds):
        unittest.TestCase.__init__(self, *args, **kwds)
        self.__catalog_service = None

        products = []
        product_skus = []
        for product_i in xrange(2):
            product = \
                Product(MagentoProduct(
                    description="Test product " + str(product_i),
                    name="Test product " + str(product_i),
                    price=Decimal(0),
                    short_description="Test product " + str(product_i),
                    sku="testproduct" + str(product_i),
                    status=MagentoProductStatus.ENABLED,
                    type=MagentoProductType.SIMPLE,
                    visibility=frozenset(("CATALOG",)),
                    url_key="testproduct" + str(product_i),
                    url_path="/testproduct" + str(product_i)
                ))
            products.append(product)
            product_skus.append(product.magento_product.sku);
        self.__products = frozenset(products)
        self.__product_skus = frozenset(product_skus)
                magento_api.catalog_product_media.list(product_dict['product_id'])
            assert not 'images' in product_dict
            product_dict['images'] = product_media_list
        except Fault, fault:
            pass

        try:
            product_tags = \
                magento_api.catalog_product_tag.list(product_dict['product_id'])
            if isinstance(product_tags, dict):
                assert not 'tags' in product_dict
                product_dict['tags'] = [tag['name']
                                        for tag in product_tags.itervalues()]
        except Fault, fault:
            pass

        product = Product(MagentoProduct.read(MagentoXmlrpcProtocol(product_dict)))

        return product

    def _head_product_by_sku(self, sku):
        try:
            self._get_product_by_sku(sku)
            return True
        except NoSuchProductException:
            return False

    def _put_orders(self, orders):
        for order in orders:
            self._put_order(order)