def runTest(self): uid_regex = re.compile(r'^[a-fA-F0-9]{32}$') category = Category(name='cat') category.full_clean(exclude=('parent',)) self.assertIsNotNone(uid_regex.match(category.uid)) item = Item(name='item', status='AVA') item.full_clean(exclude=('parent',)) self.assertIsNotNone(uid_regex.match(item.uid))
def runTest(self): item = Item(name='item', status='QTY') self.assertRaises(ValidationError, item.full_clean, exclude=('parent',)) item = Item(name='item', status='QTY', quantity=0) item.full_clean(exclude=('parent',)) self.assertEqual(item.status, 'OUT') item = Item(name='item', status='QTY', quantity=1) item.full_clean(exclude=('parent',)) self.assertEqual(item.status, 'QTY') self.assertEqual(item.quantity, 1)