Esempio n. 1
0
class MWSTestCase(unittest.TestCase):
    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        try:
            return self._marketplace
        except AttributeError:
            response = self.mws.list_marketplace_participations()
            result = response.ListMarketplaceParticipationsResult
            self._marketplace = result.ListMarketplaces.Marketplace[0]
            return self.marketplace

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(
            MarketplaceId=self.marketplace_id, ASIN=asin)
        self.assertEqual(len(response._result.Self), 3)
        categoryids = [x.ProductCategoryId for x in response._result.Self]
        self.assertSequenceEqual(categoryids, ['285856', '21', '491314'])

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(
            MarketplaceId=self.marketplace_id, Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(
            MarketplaceId=self.marketplace_id, ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, 'Serengeti')

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ['B001UDRNHO', '144930544X']
        response = self.mws.get_matching_product_for_id(
            MarketplaceId=self.marketplace_id, IdType='ASIN', IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin])
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof,
                                                  ResponseGroup='Basic')
        self.assertTrue(hasattr(response._result, 'InventorySupplyList'))
Esempio n. 2
0
File: test.py Progetto: 2uinc/boto
class MWSTestCase(TestCase):

    def __init__(self, *args, **kw):
        TestCase.__init__(self, *args, **kw)
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(\
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(\
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(\
            MarketplaceId=self.marketplace_id,
            ASINList=[asin,])
        product = response._result[0].Product


    @skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(\
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin,])
        product = response._result[0].Product
        self.assertTrue(product.LowestOfferListings)
Esempio n. 3
0
class MWSTestCase(unittest.TestCase):

    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(
            MarketplaceId=self.marketplace_id,
            ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, 'Serengeti')

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ['B001UDRNHO', '144930544X']
        response = self.mws.get_matching_product_for_id(
            MarketplaceId=self.marketplace_id,
            IdType='ASIN',
            IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin])
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof,
                                                  ResponseGroup='Basic')
        self.assertTrue(hasattr(response._result, 'InventorySupplyList'))
Esempio n. 4
0
class MWSTestCase(unittest.TestCase):

    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ('GREEN', 'GREEN_I', 'YELLOW', 'RED'))

    @property
    def marketplace(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        return result.ListMarketplaces.Marketplace[0]

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_product_categories_for_asin(\
            MarketplaceId=self.marketplace_id,
            ASIN=asin)
        result = response._result
        self.assertTrue(int(result.Self.ProductCategoryId) == 21)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(\
            MarketplaceId=self.marketplace_id,
            Query='boto')
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = 'B001UDRNHO'
        response = self.mws.get_matching_product(\
            MarketplaceId=self.marketplace_id,
            ASINList=[asin,])
        product = response._result[0].Product


    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = '144930544X'
        response = self.mws.get_lowest_offer_listings_for_asin(\
            MarketplaceId=self.marketplace_id,
            ItemCondition='New',
            ASINList=[asin,])
        product = response._result[0].Product
        self.assertTrue(product.LowestOfferListings)
Esempio n. 5
0
File: test.py Progetto: Kixeye/boto
class MWSTestCase(unittest.TestCase):
    def setUp(self):
        self.mws = MWSConnection(Merchant=simple, debug=0)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_feedlist(self):
        self.mws.get_feed_submission_list()

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_inbound_status(self):
        response = self.mws.get_inbound_service_status()
        status = response.GetServiceStatusResult.Status
        self.assertIn(status, ("GREEN", "GREEN_I", "YELLOW", "RED"))

    @property
    def marketplace(self):
        try:
            return self._marketplace
        except AttributeError:
            response = self.mws.list_marketplace_participations()
            result = response.ListMarketplaceParticipationsResult
            self._marketplace = result.ListMarketplaces.Marketplace[0]
            return self.marketplace

    @property
    def marketplace_id(self):
        return self.marketplace.MarketplaceId

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_marketplace_participations(self):
        response = self.mws.list_marketplace_participations()
        result = response.ListMarketplaceParticipationsResult
        self.assertTrue(result.ListMarketplaces.Marketplace[0].MarketplaceId)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_product_categories_for_asin(self):
        asin = "144930544X"
        response = self.mws.get_product_categories_for_asin(MarketplaceId=self.marketplace_id, ASIN=asin)
        self.assertEqual(len(response._result.Self), 3)
        categoryids = [x.ProductCategoryId for x in response._result.Self]
        self.assertSequenceEqual(categoryids, ["285856", "21", "491314"])

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_matching_products(self):
        response = self.mws.list_matching_products(MarketplaceId=self.marketplace_id, Query="boto")
        products = response._result.Products
        self.assertTrue(len(products))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product(self):
        asin = "B001UDRNHO"
        response = self.mws.get_matching_product(MarketplaceId=self.marketplace_id, ASINList=[asin])
        attributes = response._result[0].Product.AttributeSets.ItemAttributes
        self.assertEqual(attributes[0].Label, "Serengeti")

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_matching_product_for_id(self):
        asins = ["B001UDRNHO", "144930544X"]
        response = self.mws.get_matching_product_for_id(MarketplaceId=self.marketplace_id, IdType="ASIN", IdList=asins)
        self.assertEqual(len(response._result), 2)
        for result in response._result:
            self.assertEqual(len(result.Products.Product), 1)

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_get_lowest_offer_listings_for_asin(self):
        asin = "144930544X"
        response = self.mws.get_lowest_offer_listings_for_asin(
            MarketplaceId=self.marketplace_id, ItemCondition="New", ASINList=[asin]
        )
        listings = response._result[0].Product.LowestOfferListings
        self.assertTrue(len(listings.LowestOfferListing))

    @unittest.skipUnless(simple and isolator, "skipping simple test")
    def test_list_inventory_supply(self):
        asof = (datetime.today() - timedelta(days=30)).isoformat()
        response = self.mws.list_inventory_supply(QueryStartDateTime=asof, ResponseGroup="Basic")
        self.assertTrue(hasattr(response._result, "InventorySupplyList"))
Esempio n. 6
0
        title =  slsrank.GetMatchingProductForIdResult[0].Products.Product[0].AttributeSets.ItemAttributes[0].Title
    except:
        title = 'FAIL'
    try:
        slsrank = slsrank.GetMatchingProductForIdResult[0].Products.Product[0].SalesRankings.SalesRank[0].Rank
        if slsrank =='None':
            slsrank = 9999999
    except:
        slsrank = 9999999
    print 'Sales Rank: ' + str(slsrank)
    try:
        print 'Title: ' + title
    except:
        print 'Title: '

    result = conn.get_lowest_offer_listings_for_asin(MarketplaceId=marketplaceId,ASINList=ASIN)
    
    try:
        channel = result.GetLowestOfferListingsForASINResult[0].Product.LowestOfferListings.LowestOfferListing[0].Qualifiers.FulfillmentChannel
    except:
        channel = 'Unknown'
    
    #print channel
    try:
        result = result.GetLowestOfferListingsForASINResult[0].Product.LowestOfferListings.LowestOfferListing[0].Price
        lowestprice = result.ListingPrice
        shipprice = result.Shipping
    except:
        lowestprice = 0
        shipprice = 0