diff options
| author | salmonik <raisersoft@proton.me> | 2026-04-18 16:24:42 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-04-18 16:24:42 +0200 |
| commit | 857a7364ddb9b10529593c5e9c3578eb95c1da9b (patch) | |
| tree | cc160ed8685039fcb08663226395fb97d78fcea6 /tests/README.md | |
| parent | add support for x^2+y^2=0,4 and alike (diff) | |
| download | senator-sperma-857a7364ddb9b10529593c5e9c3578eb95c1da9b.tar.gz senator-sperma-857a7364ddb9b10529593c5e9c3578eb95c1da9b.zip | |
add a test suite
Signed-off-by: salmonik <raisersoft@proton.me>
Diffstat (limited to 'tests/README.md')
| -rw-r--r-- | tests/README.md | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/tests/README.md b/tests/README.md new file mode 100644 index 0000000..77b832c --- /dev/null +++ b/tests/README.md | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | # Test Suite Coverage | ||
| 2 | |||
| 3 | This document tracks the test coverage for Senator Sperma bot. | ||
| 4 | |||
| 5 | ## Running Tests | ||
| 6 | |||
| 7 | ```bash | ||
| 8 | pytest tests/ -v | ||
| 9 | ``` | ||
| 10 | |||
| 11 | ## Coverage by Cog | ||
| 12 | |||
| 13 | | Cog | Test File | Tests | Coverage | | ||
| 14 | |-----|-----------|-------|----------| | ||
| 15 | | **say.py** | test_say.py | 3 | Basic command execution, empty text, long text | | ||
| 16 | | **web.py** | test_web.py | 3 | Success, no results, HTTP error | | ||
| 17 | | **qr.py** | test_qr.py | 4 | Generate, empty text, decode unavailable, download failure | | ||
| 18 | | **math_commands.py** | test_math_commands.py | 3 | Valid expression, invalid expression, process error | | ||
| 19 | | **ai.py** | test_ai.py | 3 | Success, empty choices, no choices key | | ||
| 20 | | **downloader.py** | test_downloader.py | 5 | File success, URL success, error, message with/without URL | | ||
| 21 | | **search.py** | test_search.py | 5 | Success, no cache, file not found, empty filename, autocomplete | | ||
| 22 | | **tts.py** | test_tts.py | 3 | File output, voice output not in channel, error handling | | ||
| 23 | | **trigger.py** | test_trigger.py | 5 | Create, add, add not found, delete, help | | ||
| 24 | | **compression.py** | test_compression_conversion.py | 4 | Filetype detection, get compression commands | | ||
| 25 | | **conversion.py** | test_compression_conversion.py | 5 | Build conversion commands, cleanup | | ||
| 26 | | **plot.py** | test_plot.py | 6 | Parse expression, is implicit, parse implicit, command execution | | ||
| 27 | | **vclogs.py** | test_vclogs.py | 7 | Format duration, load/save activity, state change handlers | | ||
| 28 | | **voice.py** | test_voice.py | 5 | Get manager, join channel, get status, stop | | ||
| 29 | | **music/join.py** | test_music_join.py | 1 | Join command success | | ||
| 30 | | **music/stop.py** | test_music_join.py | 1 | Stop command success | | ||
| 31 | | **music/play_commands.py** | test_music_play.py | 4 | Search embed, validation errors | | ||
| 32 | | **music/loop.py** | test_music_play.py | 2 | Is looping, toggle | | ||
| 33 | | **music/audio_playback.py** | test_music_audio.py | 8 | Validate voice, prepare source, cleanup | | ||
| 34 | | **assistant.py** | test_assistant.py | 4 | Keyword, on_message filtering, mentions | | ||
| 35 | |||
| 36 | ## Test Structure | ||
| 37 | |||
| 38 | ``` | ||
| 39 | tests/ | ||
| 40 | ├── conftest.py # Shared fixtures and mock classes | ||
| 41 | ├── cogs/ | ||
| 42 | │ ├── test_say.py | ||
| 43 | │ ├── test_web.py | ||
| 44 | │ ├── test_qr.py | ||
| 45 | │ ├── test_math_commands.py | ||
| 46 | │ ├── test_ai.py | ||
| 47 | │ ├── test_downloader.py | ||
| 48 | │ ├── test_search.py | ||
| 49 | │ ├── test_tts.py | ||
| 50 | │ ├── test_trigger.py | ||
| 51 | │ ├── test_compression_conversion.py | ||
| 52 | │ ├── test_plot.py | ||
| 53 | │ ├── test_vclogs.py | ||
| 54 | │ ├── test_voice.py | ||
| 55 | │ ├── test_music_join.py | ||
| 56 | │ ├── test_music_play.py | ||
| 57 | │ ├── test_music_audio.py | ||
| 58 | │ └── test_assistant.py | ||
| 59 | └── README.md # This file | ||
| 60 | ``` | ||
| 61 | |||
| 62 | ## Mock Classes | ||
| 63 | |||
| 64 | The test suite uses custom mock classes defined in `conftest.py`: | ||
| 65 | |||
| 66 | - `MockUser` - Simulates Discord user | ||
| 67 | - `MockChannel` / `MockTextChannel` / `MockVoiceChannel` - Simulates Discord channels | ||
| 68 | - `MockGuild` - Simulates Discord guild | ||
| 69 | - `MockMessage` - Simulates Discord message | ||
| 70 | - `MockInteraction` - Simulates Discord interaction | ||
| 71 | - `MockApplicationContext` - Simulates slash command context | ||
| 72 | |||
| 73 | ## Test Categories | ||
| 74 | |||
| 75 | 1. **Unit tests** - Test individual functions and methods | ||
| 76 | 2. **Integration tests** - Test command execution with mocked dependencies | ||
| 77 | 3. **Error handling tests** - Test error conditions and edge cases | ||
| 78 | |||
| 79 | ## Notes | ||
| 80 | |||
| 81 | - External services (OpenAI, yt-dlp, ffmpeg) are mocked | ||
| 82 | - Database operations in trigger.py are mocked | ||
| 83 | - File system operations are mocked where needed | ||
| 84 | - Some tests may require specific environment variables to be set (mocked) \ No newline at end of file | ||
