def setUp(self): size = self.sizes.get(getattr(self,'test_size','normal')) inst_names = populate('string',size, min_len = 5, max_len = 20) inst_types = populate('choice',size, choice_from = insts_types) inst_ccys = populate('choice',size, choice_from = ccys_types) with transaction(Instrument) as t: for name,typ,ccy in zip(inst_names,inst_types,inst_ccys): Instrument(name = name, type = typ, ccy = ccy).save(t)
def testDeleteTransaction(self): with transaction(Instrument, Fund, Position) as t: for inst in Instrument.objects.all(): inst.delete(t)
def test_SaveIndexTransaction(self): with transaction(Instrument) as t: for inst in self.insts: inst.name = 'bla' inst.save(t)
def test_SaveNoIndexTransaction(self): with transaction(Instrument) as t: for inst in self.insts: inst.description = 'bla' inst.save(t)