test : add unit tests for NetworkPolicyEngine audit export methods
@Rafiaminhaj がすでに取り組んでいます。
2026年8月15日 から。
評価
この issue はまだ評価されていません。
説明
Summary of What Needs to be Done:
Add unit tests for the export_audit_log and clear_audit_entries methods of NetworkPolicyEngine in backend/secuscan/network_policy.py. These methods are not covered by the existing test_network_policy.py suite which focuses on check_access and policy enforcement logic.
The methods require patching the backend.secuscan.config module (which imports Pydantic) so the engine can be instantiated with test settings. Both methods have substantial logic worth testing: export_audit_log formats audit entries as JSON or CSV, and clear_audit_entries removes all entries from memory.
Changes that Need to be Made:
Create testing/backend/unit/test_network_policy_audit_export.py:
- Patch
sys.modules['backend.secuscan.config']with a mock config module before importingNetworkPolicyEngineandPolicyAction export_audit_log(format="json"): Test that it returns valid JSON with expected fields (timestamp, plugin_id, task_id, action, dest_ip, dest_port, reason)export_audit_log(format="csv"): Test that it returns valid CSV with header row and data rowsexport_audit_log(format="csv"): Test that empty audit log produces just the header rowclear_audit_entries(): Test that it removes all entries after entries have been addedclear_audit_entries(): Test that calling it on an already-empty log is safe (no exception)get_audit_entries()as a companion: verify it returns entries before clear and empty list after- Use a temp file path for
audit_log_pathandmax_audit_entries=1000in the engine constructor - Import the real production class directly (not mocked)
- Run with
python3 -m pytest testing/backend/unit/test_network_policy_audit_export.py -v --noconftest
Impact that it would Provide:
- Tests audit log export functionality that is currently completely untested
- Prevents regressions in the JSON and CSV export formatting logic
- Ensures the clear operation is idempotent and safe on empty state
- Complements the existing
TestAuditLoggingclass which only tests audit entry creation, not export/clear
Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.
- 主要言語
- Python
- スター
- 36
- フォーク
- 234
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
utksh1/SecuScan のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
-
area:frontend good first issue level:intermediate priority:low type:testing
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
area:frontend good first issue level:beginner priority:low type:testing
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
utksh1/SecuScan の issue をすべて見る
似ている issue
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned session対応中かも @bodapatisaikrishna が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
external
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
langchain-ai/docs#7652 ·
メンテナーはふだん 1 日以内に返信
-
[oblt-aw][autodoc] Document new e2e-secret-leak-artifacts workflow and update e2e-all leaf listオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
elastic/oblt-aw#2513 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug p2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 1/5 1時間未満 初心者へのやさしさ 75/100
NCAR/CLM-Tutorial#113 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信