tests.test_django_permissions module

Unit tests for Django permissions integration utility.

This module tests the Django database integration functionality used by the Discord bot to check permissions.

class tests.test_django_permissions.TestDjangoPermissions(methodName='runTest')[source]

Bases: TestCase

Test cases for Django permissions integration.

setUp()[source]

Set up test fixtures.

test_get_django_database_path_default()[source]

Test getting Django database path with default fallback.

test_get_django_database_path_with_config()[source]

Test getting Django database path from config file.

test_get_django_database_path_exception_handling()[source]

Test that database path function handles exceptions gracefully.

test_get_server_permission_config_no_database()[source]

Test getting server permission config when database doesn’t exist.

test_get_permission_error_message_no_config()[source]

Test getting permission error message when no config is provided.

test_get_permission_error_message_with_config()[source]

Test getting permission error message with config.

test_permission_functions_exist()[source]

Test that all required permission functions exist and are callable.

test_get_django_database_path_sqlite_prefix()[source]

Test database path extraction from different SQLite URL formats.

test_get_django_database_path_yaml_parsing()[source]

Test that function properly parses YAML configuration.

test_get_django_database_path_non_sqlite()[source]

Test behavior with non-SQLite database URLs.

test_get_permission_error_message_different_permissions()[source]

Test permission error messages for different permission types.

test_get_permission_error_message_missing_attribute()[source]

Test permission error message when config lacks the requested permission.