def _pre_setup(self): from johnny import middleware self.saved_MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES if getattr(self.__class__, 'middleware', None): settings.MIDDLEWARE_CLASSES = self.__class__.middleware self.saved_DISABLE_SETTING = getattr(johnny_settings, 'DISABLE_QUERYSET_CACHE', False) johnny_settings.DISABLE_QUERYSET_CACHE = False self.saved_TEMPLATE_LOADERS = settings.TEMPLATE_LOADERS if django.VERSION[:2] < (1, 3): if 'django.template.loaders.app_directories.load_template_source' not in settings.TEMPLATE_LOADERS: settings.TEMPLATE_LOADERS += ('django.template.loaders.app_directories.load_template_source',) else: if 'django.template.loaders.app_directories.Loader' not in settings.TEMPLATE_LOADERS: settings.TEMPLATE_LOADERS += ('django.template.loaders.app_directories.Loader',) self.middleware = middleware.QueryCacheMiddleware() self.saved_ROOT_URLCONF = settings.ROOT_URLCONF settings.ROOT_URLCONF = 'johnny.tests.testapp.urls' super(TransactionJohnnyWebTestCase, self)._pre_setup()
def setUp(self): self.middleware = middleware.QueryCacheMiddleware()
def _pre_setup(self): self.saved_DISABLE_SETTING = getattr(johnny_settings, 'DISABLE_QUERYSET_CACHE', False) johnny_settings.DISABLE_QUERYSET_CACHE = False self.middleware = middleware.QueryCacheMiddleware()