from __future__ import unicode_literals import os import unittest from guardian.utils import abspath from guardian.conf import settings as guardian_settings from django.conf import settings from django.conf import UserSettingsHolder from django.utils.functional import wraps THIS = abspath(os.path.dirname(__file__)) TEST_TEMPLATES_DIR = abspath(THIS, 'templates') TEST_SETTINGS = dict(TEMPLATE_DIRS=[TEST_TEMPLATES_DIR], ) def skipUnlessTestApp(obj): app = 'guardian.testapp' return unittest.skipUnless( app in settings.INSTALLED_APPS, 'app %r must be installed to run this test' % app)(obj) class TestDataMixin(object): def setUp(self): super(TestDataMixin, self).setUp() from django.contrib.auth.models import Group try: from django.contrib.auth import get_user_model User = get_user_model() except ImportError: from django.contrib.auth.models import User
import os from guardian.compat import unittest from guardian.utils import abspath from django.conf import settings from django.conf import UserSettingsHolder from django.utils.functional import wraps THIS = abspath(os.path.dirname(__file__)) TEST_TEMPLATES_DIR = abspath(THIS, 'templates') TEST_SETTINGS = dict( TEMPLATE_DIRS=[TEST_TEMPLATES_DIR], ) def skipUnlessTestApp(obj): app = 'guardian.testapp' return unittest.skipUnless(app in settings.INSTALLED_APPS, 'app %r must be installed to run this test' % app)(obj) class TestDataMixin(object): def setUp(self): super(TestDataMixin, self).setUp() from django.contrib.auth.models import Group try: from django.contrib.auth import get_user_model User = get_user_model()