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 f187ccdbcf)
This commit is contained in:
franck cuny 2012-05-09 14:15:39 -07:00
parent 0c2c1ea2a3
commit f301056b71
1 changed files with 24 additions and 0 deletions

View File

@ -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()