From f301056b7101651914d9def42300e28778f5affe Mon Sep 17 00:00:00 2001 From: franck cuny Date: Wed, 9 May 2012 14:15:39 -0700 Subject: [PATCH] Add a new test file for the SQLAlchemy transport Add a simple test to parse URLs for SQLAlchemy. This tests should prevent issues that were introduced (GH-127 and the one fixed by f187ccdbcf1) --- kombu/tests/transport/test_sqlalchemy.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 kombu/tests/transport/test_sqlalchemy.py diff --git a/kombu/tests/transport/test_sqlalchemy.py b/kombu/tests/transport/test_sqlalchemy.py new file mode 100644 index 00000000..a043b0fc --- /dev/null +++ b/kombu/tests/transport/test_sqlalchemy.py @@ -0,0 +1,24 @@ +from __future__ import absolute_import + +import tempfile + +from kombu.connection import BrokerConnection +from kombu.tests.utils import TestCase + +class test_sqlalchemy(TestCase): + + def test_url_parser(self): + from kombu.transport import sqlalchemy + + tmppath = tempfile.mkdtemp() + + url = "sqlalchemy+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + connection = BrokerConnection(url).connect() + + url = "sqla+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + connection = BrokerConnection(url).connect() + + # Should prevent regression fixed by f187ccd + url = "sqlb+sqlite://{path}/celerydb.sqlite".format(path=tmppath) + with self.assertRaises(KeyError): + BrokerConnection(url).connect()