Beispiel #1
0
 def testFlushRelatedModel(self):
     self.data.makePositions()
     self.assertTrue(Instrument.flush()>self.data.num_insts)
     self.assertEqual(Position.objects.all().count(),0)
     self.assertEqual(Instrument.objects.all().count(),0)
     # Now we check the database if it is empty as it should
     Fund.flush()
     keys = list(Instrument._meta.cursor.keys())
     self.assertEqual(len(keys),0)
Beispiel #2
0
    def testFlushSimpleModel(self):
        '''Use the class method flush to remove all instances of a
 Model including filters.'''
        self.data.create()
        self.assertTrue(Instrument.flush()>self.data.num_insts)
        self.assertEqual(Instrument.objects.all().count(),0)
        Fund.flush()
        # Now we check the database if it is empty as it should
        keys = list(Instrument._meta.cursor.keys())
        self.assertEqual(len(keys),0)