Пример #1
0
 def test_mysql_userport(self):
     u = url.make_url("mysql://*****:*****@host:1234/dbname")
     kwargs = dict(basedir='my-base-dir')
     u, kwargs, max_conns = enginestrategy.special_case_mysql(u, kwargs)
     self.assertEqual([str(u), max_conns, self.filter_kwargs(kwargs)],
                      ["mysql://*****:*****@host:1234/dbname?"
                       "charset=utf8&use_unicode=True", None, self.mysql_kwargs])
Пример #2
0
 def test_mysql_args(self):
     u = url.make_url("mysql:///dbname?foo=bar")
     kwargs = dict(basedir='my-base-dir')
     u, kwargs, max_conns = enginestrategy.special_case_mysql(u, kwargs)
     self.assertEqual([str(u), max_conns, self.filter_kwargs(kwargs)],
                      ["mysql:///dbname?charset=utf8&foo=bar&use_unicode=True",
                       None, self.mysql_kwargs])
Пример #3
0
 def test_mysql_max_idle(self):
     u = url.make_url("mysql:///dbname?max_idle=1234")
     kwargs = dict(basedir='my-base-dir')
     u, kwargs, max_conns = enginestrategy.special_case_mysql(u, kwargs)
     exp = self.mysql_kwargs.copy()
     exp['pool_recycle'] = 1234
     self.assertEqual([str(u), max_conns, self.filter_kwargs(kwargs)],
                      ["mysql:///dbname?charset=utf8&use_unicode=True", None,
                       exp])
Пример #4
0
 def test_mysql_storage_engine(self):
     u = url.make_url("mysql:///dbname?storage_engine=foo")
     kwargs = dict(basedir='my-base-dir')
     u, kwargs, max_conns = enginestrategy.special_case_mysql(u, kwargs)
     exp = self.mysql_kwargs.copy()
     exp['connect_args'] = dict(
         init_command='SET default_storage_engine=foo')
     self.assertEqual([str(u), max_conns, self.filter_kwargs(kwargs)],
                      ["mysql:///dbname?charset=utf8&use_unicode=True", None,
                       exp])
Пример #5
0
 def test_mysql_bad_use_unicode(self):
     u = url.make_url("mysql:///dbname?use_unicode=maybe")
     kwargs = dict(basedir='my-base-dir')
     with self.assertRaises(TypeError):
         enginestrategy.special_case_mysql(u, kwargs)
Пример #6
0
 def test_mysql_bad_charset(self):
     u = url.make_url("mysql:///dbname?charset=ebcdic")
     kwargs = dict(basedir='my-base-dir')
     with self.assertRaises(TypeError):
         enginestrategy.special_case_mysql(u, kwargs)