Beispiel #1
0
    def setUp(self):
        super(TestConvertingAFulfillmentLineToItemDict, self).setUp()
        self.line = mwsm.FulfillmentOrderLine(order_item_id='123', quantity=5)
        self.line.line = Line()

        profile = factories.AmazonProfileFactory(sku='MY-SKU')
        self.line.line.product = profile.product
Beispiel #2
0
 def test_getting_standard_product_from_asin(self):
     asin = 'FAKE12345'
     profile = factories.AmazonProfileFactory(asin=asin)
     spi = profile.get_standard_product_id()
     self.assertEquals(
         etree.tostring(spi),
         PRODUCT_TYPE_XML.format('ASIN', asin)
     )
Beispiel #3
0
 def test_getting_standard_product_from_upc(self):
     upc = '1234567890'
     profile = factories.AmazonProfileFactory(product__upc=upc)
     spi = profile.get_standard_product_id()
     self.assertEquals(
         etree.tostring(spi),
         PRODUCT_TYPE_XML.format('UPC', upc)
     )
Beispiel #4
0
    def test_enforcing_stockrecord_partner_sku(self):
        profile = factories.AmazonProfileFactory()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)

        profile.sku = 'fake12345'
        profile.save()
        stockrecord = profile.product.stockrecords.all()[0]
        self.assertEquals(profile.sku, stockrecord.partner_sku)
Beispiel #5
0
    def test_can_create_feed_for_base_attributes(self):
        product = create_product()
        profile = factories.AmazonProfileFactory(
            product=product, release_date=UTC_NOW)

        mapper = ProductMapper(product=product)
        xml = etree.tostring(mapper.get_product_xml())
        self.assertIn(
            '<SKU>{0}</SKU>'.format(profile.sku), xml)
        self.assertIn(
            '<ReleaseDate>{0}</ReleaseDate>'.format(UTC_NOW.isoformat()), xml)
        self.assertIn('<Title>{0}</Title>'.format(product.title), xml)
Beispiel #6
0
    def setUp(self):
        self.product = factories.ProductFactory(
            upc='9781741173420',
            title='Kayaking Around Australia',
            amazon_profile=None)

        self.merchant = factories.MerchantAccountFactory(
            name="Integration Test Account",
            seller_id=os.getenv('SELLER_ID'),
            aws_api_key=os.getenv('AWS_ACCESS_KEY_ID'),
            aws_api_secret=os.getenv('AWS_SECRET_ACCESS_KEY'))

        self.marketplace = factories.AmazonMarketplaceFactory(
            merchant=self.merchant, marketplace_id='ATVPDKIKX0DER')

        amazon_profile = factories.AmazonProfileFactory(
            product=self.product,
            fulfillment_by=AmazonProfile.FULFILLMENT_BY_AMAZON)

        amazon_profile.marketplaces.add(self.marketplace)
Beispiel #7
0
 def test_deleting_profile_does_not_delete_associated_product(self):
     profile = factories.AmazonProfileFactory()
     self.assertEquals(Product.objects.count(), 1)
     profile.delete()
     self.assertEquals(Product.objects.count(), 1)
Beispiel #8
0
 def test_enforcing_stockrecord_sku_is_skipped_when_disabled(self):
     profile = factories.AmazonProfileFactory()
     stockrecord = profile.product.stockrecords.all()[0]
     self.assertNotEquals(profile.sku, stockrecord.partner_sku)
Beispiel #9
0
 def test_returns_none_when_upc_too_long(self):
     upc = '12345678901234567'
     profile = factories.AmazonProfileFactory(product__upc=upc)
     self.assertEquals(profile.get_standard_product_id(), None)