def test_with_no_stock_on_stock_record(self):
        xml_data = self.load_data('list_inventory_supply_response.xml')
        httpretty.register_uri(
            httpretty.POST,
            'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01',
            body=xml_data)

        update_inventory([self.profile.product])

        stockrecord = StockRecord.objects.get(id=self.stockrecord.id)
        self.assertEquals(stockrecord.num_in_stock, 3)
        self.assertEquals(stockrecord.num_allocated, 0)
Exemplo n.º 2
0
    def test_with_no_stock_on_stock_record(self):
        xml_data = self.load_data('list_inventory_supply_response.xml')
        httpretty.register_uri(
            httpretty.POST,
            'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01',
            body=xml_data)

        update_inventory([self.profile.product])

        stockrecord = StockRecord.objects.get(id=self.stockrecord.id)
        self.assertEquals(stockrecord.num_in_stock, 3)
        self.assertEquals(stockrecord.num_allocated, 0)
    def test_with_invalid_stock_value_in_response(self):
        xml_data = self.load_data('list_inventory_supply_response.xml')
        xml_data = xml_data.replace(
            "<InStockSupplyQuantity>3</InStockSupplyQuantity>",
            "<InStockSupplyQuantity>INVALID</InStockSupplyQuantity>")
        print xml_data
        httpretty.register_uri(
            httpretty.POST,
            'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01',
            body=xml_data)

        update_inventory([self.profile.product])

        stockrecord = StockRecord.objects.get(id=self.stockrecord.id)
        self.assertFalse(stockrecord.num_in_stock)
        self.assertFalse(stockrecord.num_allocated)
Exemplo n.º 4
0
    def test_with_invalid_stock_value_in_response(self):
        xml_data = self.load_data('list_inventory_supply_response.xml')
        xml_data = xml_data.replace(
            "<InStockSupplyQuantity>3</InStockSupplyQuantity>",
            "<InStockSupplyQuantity>INVALID</InStockSupplyQuantity>")
        print xml_data
        httpretty.register_uri(
            httpretty.POST,
            'https://mws.amazonservices.com/FulfillmentInventory/2010-10-01',
            body=xml_data)

        update_inventory([self.profile.product])

        stockrecord = StockRecord.objects.get(id=self.stockrecord.id)
        self.assertFalse(stockrecord.num_in_stock)
        self.assertFalse(stockrecord.num_allocated)