示例#1
0
 def test_db_str_sqlite_absolute(self):
     # Standard syntax
     self.assertEqual(('sqlite', {'path': '/var/db/trac.db'}),
                      _parse_db_str('sqlite:///var/db/trac.db'))
     # Legacy syntax
     self.assertEqual(('sqlite', {'path': '/var/db/trac.db'}),
                      _parse_db_str('sqlite:/var/db/trac.db'))
示例#2
0
 def test_db_str_sqlite_relative(self):
     # Default syntax for specifying DB path relative to the environment
     # directory
     self.assertEqual(('sqlite', {'path': 'db/trac.db'}),
                      _parse_db_str('sqlite:db/trac.db'))
示例#3
0
 def test_db_str_postgres_with_creds(self):
     self.assertEqual(('postgres', {'user': '******', 'password': '******',
                                    'host': 'localhost', 'port': 9431,
                                    'path': '/trac'}),
                      _parse_db_str('postgres://*****:*****@localhost:9431/trac'))
示例#4
0
 def test_db_str_postgres_with_port(self):
     self.assertEqual(('postgres', {'host': 'localhost', 'port': 9431,
                                    'path': '/trac'}),
                      _parse_db_str('postgres://localhost:9431/trac'))
示例#5
0
 def test_db_str_postgres_simple(self):
     self.assertEqual(('postgres', {'host': 'localhost', 'path': '/trac'}),
                      _parse_db_str('postgres://localhost/trac'))
示例#6
0
 def test_db_str_sqlite_with_timeout_param(self):
     # In-memory database
     self.assertEqual(('sqlite', {'path': 'db/trac.db',
                                  'params': {'timeout': '10000'}}),
                      _parse_db_str('sqlite:db/trac.db?timeout=10000'))