Commits

Waldemar Kornewald  committed 86e35a5

added permission backend unit tests

  • Participants
  • Parent commits 213b225

Comments (0)

Files changed (2)

File djangotoolbox/admin.py

 admin.site.unregister(User)
 admin.site.unregister(Group)
 
-backends = getattr(settings, 'AUTHENTICATION_BACKENDS', list())
 backend_name = 'djangotoolbox.auth.backends.NonrelPermissionBackend'
-if backend_name in backends:
+if backend_name in settings.AUTHENTICATION_BACKENDS:
     admin.site.register(User, NonrelPermissionCustomUserAdmin)
     admin.site.register(Permission, PermissionAdmin)
     admin.site.register(Group, CustomGroupAdmin)

File djangotoolbox/tests.py

 from .fields import ListField
+from django.conf import settings
 from django.db import models
 from django.db.models import Q
 #from django.db.utils import DatabaseError
 from django.test import TestCase
 
+backend_name = 'djangotoolbox.auth.backends.NonrelPermissionBackend'
+if backend_name in settings.AUTHENTICATION_BACKENDS:
+    from .auth.tests import BackendTest
+
 class ListModel(models.Model):
     floating_point = models.FloatField()
     names = ListField(models.CharField(max_length=500))