summaryrefslogtreecommitdiff
path: root/oslo_db/tests/sqlalchemy/test_utils.py
diff options
context:
space:
mode:
authorzhangyangyang <zhangyangyang@unionpay.com>2017-10-11 17:17:18 +0800
committerzhangyangyang <zhangyangyang@unionpay.com>2017-10-13 13:02:12 +0000
commit73e72f6cc25cea5f10fc1cef78a0470625cfc703 (patch)
treeeb78ce58189dcae16ac2803770f4e08ad1d193a3 /oslo_db/tests/sqlalchemy/test_utils.py
parente2fa4c2246b0716c822d767aaf773767b6d6e04a (diff)
downloadoslo-db-73e72f6cc25cea5f10fc1cef78a0470625cfc703.tar.gz
Remove method get_connect_string and is_backend_avail
method get_connect_string is deprecated and will be removed from oslo_db in a few releases.Please use the provisioning system for dealing with URLs and database provisioning. method is_backend_avail is deprecated and will be removed from oslo_db in a few releases.Please use the provisioning system to access databases based on backend availability. Change-Id: Idc27d45e96aad7b28b4332b0d8ab8c10bca73e67
Diffstat (limited to 'oslo_db/tests/sqlalchemy/test_utils.py')
-rw-r--r--oslo_db/tests/sqlalchemy/test_utils.py33
1 files changed, 0 insertions, 33 deletions
diff --git a/oslo_db/tests/sqlalchemy/test_utils.py b/oslo_db/tests/sqlalchemy/test_utils.py
index a380b09..8e46307 100644
--- a/oslo_db/tests/sqlalchemy/test_utils.py
+++ b/oslo_db/tests/sqlalchemy/test_utils.py
@@ -992,34 +992,6 @@ class TestConnectionUtils(test_utils.BaseTestCase):
patch_onconnect.start()
self.addCleanup(patch_onconnect.stop)
- def test_connect_string(self):
- connect_string = utils.get_connect_string(**self.full_credentials)
- self.assertEqual(self.connect_string, connect_string)
-
- def test_connect_string_sqlite(self):
- sqlite_credentials = {'backend': 'sqlite', 'database': 'test.db'}
- connect_string = utils.get_connect_string(**sqlite_credentials)
- self.assertEqual('sqlite:///test.db', connect_string)
-
- def test_is_backend_avail(self):
- self.mox.StubOutWithMock(sqlalchemy.engine.base.Engine, 'connect')
- fake_connection = self.mox.CreateMockAnything()
- fake_connection.close()
- sqlalchemy.engine.base.Engine.connect().AndReturn(fake_connection)
- self.mox.ReplayAll()
-
- self.assertTrue(utils.is_backend_avail(**self.full_credentials))
-
- def test_is_backend_unavail(self):
- log = self.useFixture(fixtures.FakeLogger())
- err = OperationalError("Can't connect to database", None, None)
- 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()
- self.assertFalse(utils.is_backend_avail(**self.full_credentials))
- self.assertEqual(error_msg, log.output)
-
def test_ensure_backend_available(self):
self.mox.StubOutWithMock(sqlalchemy.engine.base.Engine, 'connect')
fake_connection = self.mox.CreateMockAnything()
@@ -1073,11 +1045,6 @@ class TestConnectionUtils(test_utils.BaseTestCase):
self.assertEqual(('dude', 'pass', 'test', 'localhost'),
utils.get_db_connection_info(conn_pieces))
- def test_connect_string_host(self):
- self.full_credentials['host'] = 'myhost'
- connect_string = utils.get_connect_string(**self.full_credentials)
- self.assertEqual('postgresql://dude:pass@myhost/test', connect_string)
-
class MyModelSoftDeletedProjectId(declarative_base(), models.ModelBase,
models.SoftDeleteMixin):