G-1: 메신저 Webhook Relay + _send_to_room 실제 httpx 호출 구현 G-2: POST /api/tasks/bulk SR 대량작업 엔드포인트 (최대 100건) G-3: 라이선스 만료 알림 스케줄러 (매일 09:00 KST) G-4: 체험판 upgrade_banner 필드 + license.py 배너 로직 G-5: core/auto_rca.py + incidents/problem auto-rca 엔드포인트 G-6: core/deploy_impact.py + vibe impact-analysis 엔드포인트 G-7: core/ticket_classifier.py + SR 생성 시 AI 분류 + ai-suggestion API G-8: VulnPatchRecord 모델 + vuln_scan 패치추적 4개 엔드포인트 G-9: core/jira_sync.py + gateway Jira/Confluence 연동 엔드포인트 G-10: core/push_notify.py + routers/push.py + PushSubscription 모델 G-11: approvals 다중승인 (위임/서명/기한초과/마감연장) G-12: alembic.ini + migrations/ + cicd/migrate_to_postgres.sh 하네스: guardia-orchestrator 확장기능 Phase 반영 봇명령어: /sr /status /license /bulk 슬래시 명령어 추가 설치스크립트: setup/ (Ubuntu, CentOS, RHEL, Windows) --test 옵션 포함 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
45 lines
1.3 KiB
Python
45 lines
1.3 KiB
Python
"""직원 API 테스트"""
|
|
import pytest
|
|
from fastapi.testclient import TestClient
|
|
from app.main import app
|
|
from app.database import get_db, engine
|
|
from app.models.base import Base
|
|
|
|
Base.metadata.create_all(bind=engine)
|
|
client = TestClient(app)
|
|
|
|
|
|
def test_health_check():
|
|
resp = client.get("/health")
|
|
assert resp.status_code == 200
|
|
assert resp.json()["status"] == "ok"
|
|
|
|
|
|
def test_list_employees_empty():
|
|
resp = client.get("/api/employees/")
|
|
assert resp.status_code == 200
|
|
assert isinstance(resp.json(), list)
|
|
|
|
|
|
def test_create_employee():
|
|
payload = {
|
|
"emp_no": "EMP-001",
|
|
"name": "홍길동",
|
|
"department": "개발팀",
|
|
"position": "선임",
|
|
"email": "hong@test.com",
|
|
"salary": "5000000",
|
|
}
|
|
resp = client.post("/api/employees/", json=payload)
|
|
assert resp.status_code == 201
|
|
assert resp.json()["name"] == "홍길동"
|
|
|
|
|
|
def test_sql_injection_vulnerability():
|
|
"""SQL 인젝션 취약점 검증 테스트 (현재 취약함)"""
|
|
# 이 테스트는 취약점을 문서화하기 위한 것
|
|
resp = client.get("/api/employees/search/name?name='; DROP TABLE tb_employee; --")
|
|
# 취약한 경우 500 에러 또는 예상치 못한 결과
|
|
# 개선 후에는 안전하게 처리되어야 함
|
|
assert resp.status_code in [200, 400, 500]
|