def test_fails_gracefully_if_no_marketplace_found(merchant): assert merchant.marketplaces.count() == 0 merchant.aws_api_key = 'invalidkey' merchant.aws_api_secret = 'invalidsecret' merchant.save() update_marketplaces(merchant) assert merchant.marketplaces.count() == 0
def test_can_be_updated_from_mws(self): xml = self.load_data("list_marketplace_participations_response.xml") httpretty.register_uri(httpretty.GET, "https://mws.amazonservices.com/Sellers/2011-07-01", body=xml) self.merchant = factories.MerchantAccountFactory(seller_id="ASLLRIDHERE1J56") self.assertEquals(self.merchant.marketplaces.count(), 0) gateway.update_marketplaces(self.merchant) self.assertEquals(self.merchant.marketplaces.count(), 1) marketplace = self.merchant.marketplaces.all()[0] self.assertEquals(marketplace.marketplace_id, "ATVPDKIKX0DER") self.assertEquals(marketplace.domain, "www.amazon.com") self.assertEquals(marketplace.name, "Amazon.com") self.assertEquals(marketplace.currency_code, "USD") self.assertEquals(marketplace.region, "US")
def test_can_be_updated_from_mws(self): xml = self.load_data('list_marketplace_participations_response.xml') httpretty.register_uri( httpretty.GET, 'https://mws.amazonservices.com/Sellers/2011-07-01', body=xml, ) self.merchant = factories.MerchantAccountFactory( seller_id='ASLLRIDHERE1J56') self.assertEquals(self.merchant.marketplaces.count(), 0) gateway.update_marketplaces(self.merchant) self.assertEquals(self.merchant.marketplaces.count(), 1) marketplace = self.merchant.marketplaces.all()[0] self.assertEquals(marketplace.marketplace_id, 'ATVPDKIKX0DER') self.assertEquals(marketplace.domain, 'www.amazon.com') self.assertEquals(marketplace.name, 'Amazon.com') self.assertEquals(marketplace.currency_code, 'USD') self.assertEquals(marketplace.region, 'US')
def test_marketplaces_can_be_retrieved_for_merchant_account(merchant): assert merchant.marketplaces.count() == 0 update_marketplaces(merchant) market_ids = [m.marketplace_id for m in merchant.marketplaces.all()] assert sorted(market_ids) == sorted([u'ATVPDKIKX0DER', u'A2ZV50J4W1RKNI'])