def test_check_legacy_settings(self): with SettingsOverride(settings, ALLOW_STAFF_TO_HIJACKUSER=True): warnings = checks.check_legacy_settings(HijackConfig) expected_warnings = [ Warning( 'Deprecation warning: Setting "ALLOW_STAFF_TO_HIJACKUSER" has been renamed to "HIJACK_AUTHORIZE_STAFF"', hint=None, obj=None, id="hijack.W002", ) ] self.assertEqual(warnings, expected_warnings) def test_check_custom_authorization_check_importable(self): errors = checks.check_custom_authorization_check_importable( HijackConfig) self.assertFalse(errors) with SettingsOverride(hijack_settings, HIJACK_AUTHORIZATION_CHECK="not.importable"): expected_errors = [ Error( "Setting HIJACK_AUTHORIZATION_CHECK cannot be imported", hint=None, obj="not.importable", id="hijack.E002", ) ] errors = checks.check_custom_authorization_check_importable( HijackConfig) self.assertEqual(errors, expected_errors)
def test_check_legacy_settings(self): with SettingsOverride(settings, ALLOW_STAFF_TO_HIJACKUSER=True): warnings = checks.check_legacy_settings(HijackConfig) expected_warnings = [ Warning( 'Deprecation warning: Setting "ALLOW_STAFF_TO_HIJACKUSER" has been renamed to "HIJACK_AUTHORIZE_STAFF"', hint=None, obj=None, id='hijack.W002') ] self.assertEqual(warnings, expected_warnings)
def test_check_legacy_settings(self): with SettingsOverride(settings, SHOW_HIJACKUSER_IN_ADMIN=False): warnings = checks.check_legacy_settings(HijackConfig) expected_warnings = [ Warning( 'Deprecation warning: Setting "SHOW_HIJACKUSER_IN_ADMIN" has been renamed to "HIJACK_DISPLAY_ADMIN_BUTTON"', hint=None, obj=None, id='hijack.W002') ] self.assertEqual(warnings, expected_warnings)
def test_check_legacy_settings(self): with SettingsOverride(settings, SHOW_HIJACKUSER_IN_ADMIN=False): warnings = checks.check_legacy_settings(HijackConfig) expected_warnings = [ Warning( 'Deprecation warning: Setting "SHOW_HIJACKUSER_IN_ADMIN" has been renamed to "HIJACK_DISPLAY_ADMIN_BUTTON"', hint=None, obj=None, id='hijack.W002' ) ] self.assertEqual(warnings, expected_warnings)
def test_check_legacy_settings(self): with SettingsOverride(settings, ALLOW_STAFF_TO_HIJACKUSER=True): warnings = checks.check_legacy_settings(HijackConfig) expected_warnings = [ Warning( 'Deprecation warning: Setting "ALLOW_STAFF_TO_HIJACKUSER" has been renamed to "HIJACK_AUTHORIZE_STAFF"', hint=None, obj=None, id='hijack.W002' ) ] self.assertEqual(warnings, expected_warnings)