Example #1
0
 def test_serializeModel(self):
     DBSession.remove()
     self.config = testing.setUp()
     id = 10
     for i in range(15, 18):
         quote = Quote("quote_teste{0}".format(id),
                       description="foo{0}".format(id),
                       created_at=None)
         DBSession.add(quote)
         DBSession.flush()
         id += 1
     rows = DBSession.query(Quote).count()
     random_id = (randint(1, rows))
     random_json_query = DBSession.query(Quote).filter_by(
         id=random_id).first().to_json()
     print("Serialized: ", random_json_query)
     self.assertEqual(type(random_json_query), dict)
Example #2
0
 def test_random_queryDB(self):
     DBSession.remove()
     self.config = testing.setUp()
     id = 20
     for i in range(1, 5):
         quote = Quote(title="quote_teste{0}".format(id),
                       description="foo{0}".format(id),
                       created_at=None)
         DBSession.add(quote)
         DBSession.flush()
         id += 1
     rows = DBSession.query(Quote).count()
     print("Number of table rows", str(rows))
     random_id = (randint(1, rows))
     print("Picked quote:", random_id)
     random_query = DBSession.query(Quote).filter_by(id=random_id).first()
     print(random_query.to_dict())
     self.assertEqual(type(random_query.to_dict()), dict)
Example #3
0
 def test_deleleDb(self):
     DBSession.remove()
     testing.tearDown()