2010-11-12 10:34:13 +00:00
|
|
|
from nose import SkipTest
|
|
|
|
|
2013-10-14 15:09:43 +00:00
|
|
|
from kombu.tests.case import redirect_stdouts
|
2010-11-12 10:34:13 +00:00
|
|
|
|
2010-11-12 10:50:18 +00:00
|
|
|
from funtests import transport
|
|
|
|
|
2010-11-12 10:34:13 +00:00
|
|
|
|
|
|
|
class test_django(transport.TransportCase):
|
2013-04-15 16:44:13 +00:00
|
|
|
transport = 'django'
|
|
|
|
prefix = 'django'
|
2010-11-12 10:34:13 +00:00
|
|
|
event_loop_max = 10
|
|
|
|
|
|
|
|
def before_connect(self):
|
|
|
|
|
|
|
|
@redirect_stdouts
|
|
|
|
def setup_django(stdout, stderr):
|
|
|
|
try:
|
2013-04-22 14:23:13 +00:00
|
|
|
import django # noqa
|
2010-11-12 10:34:13 +00:00
|
|
|
except ImportError:
|
2013-04-22 14:23:13 +00:00
|
|
|
raise SkipTest('django not installed')
|
2010-11-12 10:34:13 +00:00
|
|
|
from django.conf import settings
|
|
|
|
if not settings.configured:
|
2013-04-22 14:23:13 +00:00
|
|
|
settings.configure(
|
|
|
|
DATABASE_ENGINE='sqlite3',
|
|
|
|
DATABASE_NAME=':memory:',
|
|
|
|
DATABASES={
|
|
|
|
'default': {
|
|
|
|
'ENGINE': 'django.db.backends.sqlite3',
|
|
|
|
'NAME': ':memory:',
|
|
|
|
},
|
|
|
|
},
|
2013-08-15 11:50:03 +00:00
|
|
|
INSTALLED_APPS=('kombu.transport.django', ),
|
2013-04-22 14:23:13 +00:00
|
|
|
)
|
2010-11-12 10:34:13 +00:00
|
|
|
from django.core.management import call_command
|
2013-04-15 16:44:13 +00:00
|
|
|
call_command('syncdb')
|
2010-11-12 10:34:13 +00:00
|
|
|
|
|
|
|
setup_django()
|