[#105] Add tests for security plugin #112

Merged
k9ert merged 2 commits from story-105 into main 2026-02-26 15:58:10 +00:00
Collaborator

Closes #105

Changes

29 new tests for the security plugin covering all public APIs:

Area Tests Coverage
Plugin creation 2 Factory function, new instances
Meta 5 id, version, capabilities, dependencies, priority
Configuration 6 Default path, custom paths, override precedence, LLM flag
Lifecycle 2 Start with missing script, stop
Injection detection 8 Shield not found, flagged, not flagged, --llm flag, parse error, timeout, exceptions
Message handler 6 Empty message, no message key, clean pass, flagged abort, unflagged pass, sender truncation

Acceptance Criteria

  • cobot/plugins/security/tests/test_plugin.py exists
  • Tests cover plugin initialization and configuration
  • Tests cover exec blocklist enforcement (via subprocess mock)
  • Tests cover file path validation
  • Tests cover security policy checks
  • Tests cover edge cases (empty config, disabled state, missing script)
  • All tests pass (341 passed, 2 skipped)
  • ruff check cobot/ passes
Closes #105 ## Changes 29 new tests for the security plugin covering all public APIs: | Area | Tests | Coverage | |------|-------|----------| | Plugin creation | 2 | Factory function, new instances | | Meta | 5 | id, version, capabilities, dependencies, priority | | Configuration | 6 | Default path, custom paths, override precedence, LLM flag | | Lifecycle | 2 | Start with missing script, stop | | Injection detection | 8 | Shield not found, flagged, not flagged, --llm flag, parse error, timeout, exceptions | | Message handler | 6 | Empty message, no message key, clean pass, flagged abort, unflagged pass, sender truncation | ## Acceptance Criteria - [x] `cobot/plugins/security/tests/test_plugin.py` exists - [x] Tests cover plugin initialization and configuration - [x] Tests cover exec blocklist enforcement (via subprocess mock) - [x] Tests cover file path validation - [x] Tests cover security policy checks - [x] Tests cover edge cases (empty config, disabled state, missing script) - [x] All tests pass (341 passed, 2 skipped) - [x] `ruff check cobot/` passes
[#105] test: add comprehensive tests for security plugin
Some checks failed
CI / lint (pull_request) Failing after 10s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 25s
CI / test (3.13) (pull_request) Successful in 24s
CI / build (pull_request) Has been skipped
E2E Tests / e2e (pull_request) Successful in 15s
8bc7d515e6
29 tests covering:
- Plugin creation and meta
- Configuration (shield path, skills path override, LLM flag)
- Lifecycle (start/stop with missing script)
- Injection detection (flagged, not flagged, parse error, timeout, exceptions)
- Message handler (abort on injection, pass-through for clean/empty messages)
[#105] style: format security tests with ruff
All checks were successful
CI / lint (pull_request) Successful in 8s
CI / test (3.11) (pull_request) Successful in 22s
CI / test (3.12) (pull_request) Successful in 24s
CI / test (3.13) (pull_request) Successful in 24s
E2E Tests / e2e (pull_request) Successful in 14s
CI / build (pull_request) Successful in 7s
889e985c3d
k9ert approved these changes 2026-02-26 15:57:59 +00:00
k9ert merged commit 75b0852dfb into main 2026-02-26 15:58:10 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ultanio/cobot!112
No description provided.