summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Sergeyev <vsergeyev@mirantis.com>2014-11-12 16:06:03 +0200
committerVictor Sergeyev <vsergeyev@mirantis.com>2014-12-09 12:22:47 +0200
commit4c939b38eb1328094e4b73eec0955ba7c2f2e67d (patch)
treecfd63adbdc45cfcbbb06d8517548183ff891eeb0
parent34caedc34224058cc9a87309e2e8c48969af772f (diff)
downloadoslo-db-4c939b38eb1328094e4b73eec0955ba7c2f2e67d.tar.gz
Fix TestConnectionUtils to py3x compatibility
Tests in TestConnectionUtils class depends on database and DB connector, so the simplest way to run them with python 3.X is to use same database and connector for the both python versions. PostgreSQL and psycopg2 are looks good for this. Replaced ``mysql`` to ``postgresql`` in TestConnectionUtils. Change-Id: Icb1d6324b58feed515e4eb885715cbf2195768cf
-rw-r--r--tests/sqlalchemy/test_utils.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/sqlalchemy/test_utils.py b/tests/sqlalchemy/test_utils.py
index c13fe9d..78fef85 100644
--- a/tests/sqlalchemy/test_utils.py
+++ b/tests/sqlalchemy/test_utils.py
@@ -512,12 +512,12 @@ class TestConnectionUtils(test_utils.BaseTestCase):
def setUp(self):
super(TestConnectionUtils, self).setUp()
- self.full_credentials = {'backend': 'mysql',
+ self.full_credentials = {'backend': 'postgresql',
'database': 'test',
'user': 'dude',
'passwd': 'pass'}
- self.connect_string = 'mysql://dude:pass@localhost/test'
+ self.connect_string = 'postgresql://dude:pass@localhost/test'
def test_connect_string(self):
connect_string = utils.get_connect_string(**self.full_credentials)
@@ -540,7 +540,7 @@ class TestConnectionUtils(test_utils.BaseTestCase):
def test_is_backend_unavail(self):
log = self.useFixture(fixtures.FakeLogger())
err = OperationalError("Can't connect to database", None, None)
- error_msg = "The mysql backend is unavailable: %s\n" % err
+ error_msg = "The postgresql backend is unavailable: %s\n" % err
self.mox.StubOutWithMock(sqlalchemy.engine.base.Engine, 'connect')
sqlalchemy.engine.base.Engine.connect().AndRaise(err)
self.mox.ReplayAll()
@@ -571,7 +571,7 @@ class TestConnectionUtils(test_utils.BaseTestCase):
)
self.assertEqual("Could not connect", str(exc))
self.assertEqual(
- "The mysql backend is unavailable: %s" % err,
+ "The postgresql backend is unavailable: %s" % err,
log.output.strip())
def test_ensure_backend_available_no_dbapi_raises(self):
@@ -588,7 +588,7 @@ class TestConnectionUtils(test_utils.BaseTestCase):
)
self.assertEqual("No DBAPI installed", str(exc))
self.assertEqual(
- "The mysql backend is unavailable: Can't import "
+ "The postgresql backend is unavailable: Can't import "
"DBAPI module foobar", log.output.strip())
def test_get_db_connection_info(self):
@@ -599,7 +599,7 @@ class TestConnectionUtils(test_utils.BaseTestCase):
def test_connect_string_host(self):
self.full_credentials['host'] = 'myhost'
connect_string = utils.get_connect_string(**self.full_credentials)
- self.assertEqual(connect_string, 'mysql://dude:pass@myhost/test')
+ self.assertEqual(connect_string, 'postgresql://dude:pass@myhost/test')
class MyModelSoftDeletedProjectId(declarative_base(), models.ModelBase,