Exemplo n.º 1
0
 def test_db(self):
     AppSettings(db_connection_string='sqlite:///:memory:')
     AppSettings.db_create_tables([User.__table__])
     user = User(name='ed',
                 fullname='Edward Scissorhands',
                 password='******')
     user.insert()
     user_from_db = User.get(name='ed')
     self.assertIsNotNone(user_from_db)
     self.assertEqual(user_from_db.password, '12345')
Exemplo n.º 2
0
 def test_setup_db_with_connection_string_parts(self):
     AppSettings(db_protocol='sqlite',
                 db_user=None,
                 db_pass=None,
                 db_end_point=None,
                 db_port=None,
                 db_name=':memory:',
                 db_connection_string_params=None)
     AppSettings.db_create_tables([User.__table__])
     user = User(name='ed',
                 fullname='Edward Scissorhands',
                 password='******')
     user.insert()
     user_from_db = User.get(name='ed')
     self.assertIsNotNone(user_from_db)
     self.assertEqual(user_from_db.password, '12345')
     AppSettings.db_close()