Example #1
0
 def setUp(self):
     session = self.session()
     with session.begin() as t:
         t.add(Dictionary(name='test'))
         t.add(Dictionary(name='test2'))
     yield t.on_result
     yield self. async .assertEqual(session.query(Dictionary).count(), 2)
Example #2
0
 def testFlushWithData(self):
     self.fill('test')
     self.fill('test2')
     Dictionary.flush()
     self.assertEqual(Dictionary.objects.all().count(),0)
     # Now we check the database if it is empty as it should
     keys = list(Dictionary._meta.cursor.keys())
     self.assertEqual(len(keys),0)
Example #3
0
 def after_setup(cls):
     with cls.session().begin() as t:
         d1 = t.add(Dictionary(name='english-italian'))
         d2 = t.add(Dictionary(name='italian-english'))
     yield t.on_result
     with cls.session().begin() as t:
         d1.data.update(
             (('ball', 'palla'), ('boat', 'nave'), ('cat', 'gatto')))
         d2.data.update(
             (('palla', 'ball'), ('nave', 'boat'), ('gatto', 'cat')))
     yield t.on_result
Example #4
0
 def setUp(self):
     self.orm.register(Dictionary)
     d = Dictionary(name='test').save()
     self.data = dict(izip(keys, values))
Example #5
0
 def testSimpleFlush(self):
     Dictionary.flush()
     self.assertEqual(Dictionary.objects.all().count(),0)
     # Now we check the database if it is empty as it should
     keys = list(Dictionary._meta.cursor.keys())
     self.assertEqual(len(keys),0)