test : add unit tests for Database.connection property error path
Chưa có ai nhận issue này.
- #2277 của @tmdeveloper007 — đã đóng, không merge
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Read backend/secuscan/database.py and inspect the Database connection property and initialization state. Then review nearby unit test conventions before creating testing/backend/unit/test_database.py; use --noconftest and an in-memory SQLite path. Done means the tests cover the disconnected error and message, plus the specified state before and after connect().
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary of What Needs to be Done:
Add unit tests for the Database.connection property error path in backend/secuscan/database.py. When the database is not connected, accessing the .connection property should raise a RuntimeError with a clear message.
Changes that Need to be Made:
Create testing/backend/unit/test_database.py (standalone unit tests) covering:
- Database(db_path=":memory:").connection raises RuntimeError when not connected
- The RuntimeError message is descriptive and actionable
- Database._connection is None before connect()
- Database._connection is set after connect()
- Database._in_transaction is False initially
Note: Use an in-memory SQLite database (":memory:") path to avoid file system dependencies. The test should NOT require a real database file.
Import from backend.secuscan.database import Database directly. Use --noconftest for local runs.
Impact that it would Provide:
- Reliability: Documents the expected error behavior when database is used before connection
- Testing: Covers an entirely untested module (database.py)
- Maintainability: Provides a clear contract for Database initialization state
Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.
- Ngôn ngữ chính
- Python
- Star
- 36
- Fork
- 234
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của utksh1/SecuScan
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
area:frontend good first issue level:beginner priority:low type:testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Tất cả issue của utksh1/SecuScan
Issue tương tự
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned sessionCó thể đã có người làm @bodapatisaikrishna đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[integration]: NoMacSandboxĐang mởexternal
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
langchain-ai/docs#7652 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[oblt-aw][autodoc] Document new e2e-secret-leak-artifacts workflow and update e2e-all leaf listĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
elastic/oblt-aw#2513 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug p2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 75/100
NCAR/CLM-Tutorial#113 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày