Fix DeprecationWarning about default_app_config in Django 3.2

This commit is contained in:
Valentin Samir 2022-10-17 19:27:26 +02:00
parent 1209c2cc68
commit 2c1236106d
3 changed files with 11 additions and 6 deletions

View file

@ -16,6 +16,7 @@ Added
Fixes Fixes
----- -----
* Fix unicode sandwich issue in cas_server.utils.update_url * Fix unicode sandwich issue in cas_server.utils.update_url
* Fix DeprecationWarning about default_app_config in Django 3.2
Removed Removed
------- -------

View file

@ -9,9 +9,11 @@
# #
# (c) 2015-2016 Valentin Samir # (c) 2015-2016 Valentin Samir
"""A django CAS server application""" """A django CAS server application"""
import django
#: version of the application #: version of the application
VERSION = '1.3.1' VERSION = '1.3.1'
#: path the the application configuration class if django.VERSION < (3, 2):
default_app_config = 'cas_server.apps.CasAppConfig' #: path the the application configuration class
default_app_config = 'cas_server.apps.CasAppConfig'

View file

@ -10,6 +10,7 @@
# #
# (c) 2016 Valentin Samir # (c) 2016 Valentin Samir
"""Tests module for utils""" """Tests module for utils"""
import django
from django.test import TestCase, RequestFactory from django.test import TestCase, RequestFactory
from django.db import connection from django.db import connection
@ -173,10 +174,11 @@ class UtilsTestCase(TestCase):
utils.import_attr('cas_server.utils.toto') utils.import_attr('cas_server.utils.toto')
with self.assertRaises(ValueError): with self.assertRaises(ValueError):
utils.import_attr('toto') utils.import_attr('toto')
self.assertEqual( if django.VERSION < (3, 2):
utils.import_attr('cas_server.default_app_config'), self.assertEqual(
'cas_server.apps.CasAppConfig' utils.import_attr('cas_server.default_app_config'),
) 'cas_server.apps.CasAppConfig'
)
self.assertEqual(utils.import_attr(utils), utils) self.assertEqual(utils.import_attr(utils), utils)
def test_update_url(self): def test_update_url(self):