def test_is_valid_serial_range(self): pitem = ProductionProducedItem(store=self.store) pitem.product = self.create_product() self.assertTrue(ProductionProducedItem.is_valid_serial_range( pitem.product, 1, 2, self.store)) pitem.serial_number = 1 self.assertFalse(ProductionProducedItem.is_valid_serial_range( pitem.product, 1, 2, self.store))
def test_get_last_serial_number(self): pitem = ProductionProducedItem(store=self.store) pitem.product = self.create_product() last = ProductionProducedItem.get_last_serial_number(pitem.product, self.store) self.assertEquals(last, 0) pitem.serial_number = 10 last = ProductionProducedItem.get_last_serial_number(pitem.product, self.store) self.assertEquals(last, 10)
def test_is_valid_serial_range(self): pitem = ProductionProducedItem(store=self.store) pitem.product = self.create_product() self.assertTrue( ProductionProducedItem.is_valid_serial_range( pitem.product, 1, 2, self.store)) pitem.serial_number = 1 self.assertFalse( ProductionProducedItem.is_valid_serial_range( pitem.product, 1, 2, self.store))
def test_get_last_serial_number(self): pitem = ProductionProducedItem(store=self.store) pitem.product = self.create_product() last = ProductionProducedItem.get_last_serial_number( pitem.product, self.store) self.assertEqual(last, 0) pitem.serial_number = 10 last = ProductionProducedItem.get_last_serial_number( pitem.product, self.store) self.assertEqual(last, 10)