tests.test_bot module

Unit tests for WeakAuras Discord Bot core functionality.

This module tests the main bot class, configuration loading, and core bot operations.

class tests.test_bot.TestWeakAurasBot(methodName='runTest')[source]

Bases: TestCase

Test cases for the WeakAurasBot class.

setUp()[source]

Set up test fixtures before each test method.

tearDown()[source]

Clean up after each test method.

test_bot_initialization()[source]

Test bot initialization with valid config.

test_bot_initialization_default_storage()[source]

Test bot initialization with default storage directory.

test_sanitize_server_name()[source]

Test server name sanitization for filesystem usage.

test_get_server_folder_new()[source]

Test getting server folder when none exists.

test_load_server_macros_no_file()[source]

Test loading server macros when no file exists.

test_load_server_macros_with_file()[source]

Test loading server macros when file exists.

test_save_server_macros()[source]

Test saving server macros to JSON file.

test_has_admin_access_with_role()[source]

Test admin access checking when user has admin role.

test_has_admin_access_without_role()[source]

Test admin access checking when user doesn’t have admin role.

test_has_admin_access_no_roles()[source]

Test admin access checking when user has no roles.

test_create_embed_basic()[source]

Test creating basic embed without logo.

Test creating embed with custom footer.

test_create_embed_with_color()[source]

Test creating embed with custom color.

test_load_server_macros_invalid_json()[source]

Test loading server macros with invalid JSON file.

test_save_server_macros_creates_directory()[source]

Test that save_server_macros creates the directory if it doesn’t exist.

test_get_server_folder_existing()[source]

Test getting server folder when it already exists.

test_sanitize_server_name_unicode()[source]

Test server name sanitization with unicode characters.

test_has_admin_access_with_permissions()[source]

Test admin access checking with user permissions.

test_has_admin_access_multiple_roles()[source]

Test admin access checking with multiple roles including admin.

test_load_embed_macro()[source]

Test loading embed macro from JSON file.

test_save_embed_macro()[source]

Test saving embed macro to JSON file.

test_mixed_macro_types()[source]

Test loading and saving both text and embed macros together.