|
9 | 9 |
|
10 | 10 | # Django imports |
11 | 11 | from django.apps import apps |
| 12 | +from django.conf import settings |
12 | 13 | from django.db.models import signals |
13 | 14 | from django.test import override_settings, tag # noqa |
14 | 15 |
|
|
18 | 19 | ) |
19 | 20 |
|
20 | 21 | # app imports |
21 | | -from .utils.testcases import AuthEnhancedPerTestDeactivatedSignalsTestCase |
| 22 | +from .utils.testcases import AuthEnhancedTestCase, AuthEnhancedPerTestDeactivatedSignalsTestCase |
22 | 23 |
|
23 | 24 |
|
24 | 25 | @tag('appconfig') |
25 | | -class AuthEnhancedConfigTests(AuthEnhancedPerTestDeactivatedSignalsTestCase): |
26 | | - """These tests target the AppConfig.""" |
| 26 | +class AuthEnhancedConfigTests(AuthEnhancedTestCase): |
| 27 | + """These tests target the AppConfig, without any signal handling.""" |
| 28 | + |
| 29 | + @override_settings(DAE_VERIFICATION_TOKEN_MAX_AGE='1h') |
| 30 | + def test_convert_time_strings(self): |
| 31 | + """Time strings are converted to seconds.""" |
| 32 | + |
| 33 | + self.assertEqual(settings.DAE_VERIFICATION_TOKEN_MAX_AGE, '1h') |
| 34 | + apps.get_app_config('auth_enhanced').ready() |
| 35 | + self.assertEqual(settings.DAE_VERIFICATION_TOKEN_MAX_AGE, 3600) |
| 36 | + |
| 37 | + @override_settings(DAE_VERIFICATION_TOKEN_MAX_AGE='foo') |
| 38 | + def test_convert_use_fallback(self): |
| 39 | + """If conversion fails, a fallback will be applied.""" |
| 40 | + |
| 41 | + self.assertEqual(settings.DAE_VERIFICATION_TOKEN_MAX_AGE, 'foo') |
| 42 | + apps.get_app_config('auth_enhanced').ready() |
| 43 | + self.assertEqual(settings.DAE_VERIFICATION_TOKEN_MAX_AGE, 3600) |
| 44 | + |
| 45 | + |
| 46 | +@tag('appconfig') |
| 47 | +class AuthEnhancedConfigSignalTests(AuthEnhancedPerTestDeactivatedSignalsTestCase): |
| 48 | + """These tests target the AppConfig, especially the signal handling.""" |
27 | 49 |
|
28 | 50 | @override_settings( |
29 | 51 | DAE_ADMIN_SIGNUP_NOTIFICATION=False, |
|
0 commit comments