Files
sam-docs/plans/flow-tests/item-delete-force-delete.json
hskwon 33ef01b2b4 docs: API 문서 및 테스트 시나리오 추가
- front/item-master-items-api.md - Items API 프론트엔드 연동 문서
- guides/menu-delete-verification-queries.md - 메뉴 삭제 검증 쿼리 가이드
- plans/flow-tests/item-delete-force-delete.json - 품목 삭제 테스트 시나리오
2025-12-12 08:51:54 +09:00

410 lines
10 KiB
JSON

{
"name": "품목 삭제 테스트 (Force Delete & 사용중 체크)",
"description": "품목 삭제 기능 테스트: 1) 사용되지 않는 품목은 Force Delete 2) 사용 중인 품목은 삭제 불가 에러 반환",
"version": "1.0",
"config": {
"baseUrl": "",
"timeout": 30000,
"stopOnFailure": true
},
"variables": {
"user_id": "{{$env.FLOW_TESTER_USER_ID}}",
"user_pwd": "{{$env.FLOW_TESTER_USER_PWD}}",
"ts": "{{$timestamp}}"
},
"steps": [
{
"id": "login",
"name": "로그인",
"method": "POST",
"endpoint": "/login",
"body": {
"user_id": "{{user_id}}",
"user_pwd": "{{user_pwd}}"
},
"expect": {
"status": [200],
"jsonPath": {
"$.access_token": "@isString"
}
},
"extract": {
"token": "$.access_token"
}
},
{
"id": "create_test_product",
"name": "테스트용 제품 생성 (FG)",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "FG",
"code": "TEST-DEL-FG-{{ts}}",
"name": "삭제테스트용 완제품",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"product_id": "$.data.id",
"product_code": "$.data.code"
}
},
{
"id": "create_test_material",
"name": "테스트용 자재 생성 (RM)",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "RM",
"code": "TEST-DEL-RM-{{ts}}",
"name": "삭제테스트용 원자재",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"material_id": "$.data.id",
"material_code": "$.data.code"
}
},
{
"id": "delete_unused_product",
"name": "사용되지 않는 제품 삭제 (Force Delete 성공)",
"method": "DELETE",
"endpoint": "/items/{{create_test_product.product_id}}?item_type=FG",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [200],
"jsonPath": {
"$.success": true
}
}
},
{
"id": "verify_product_deleted",
"name": "제품 영구 삭제 확인 (404 응답)",
"method": "GET",
"endpoint": "/items/{{create_test_product.product_id}}",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [404],
"jsonPath": {
"$.success": false
}
}
},
{
"id": "delete_unused_material",
"name": "사용되지 않는 자재 삭제 (Force Delete 성공)",
"method": "DELETE",
"endpoint": "/items/{{create_test_material.material_id}}?item_type=RM",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [200],
"jsonPath": {
"$.success": true
}
}
},
{
"id": "verify_material_deleted",
"name": "자재 영구 삭제 확인 (404 응답)",
"method": "GET",
"endpoint": "/items/{{create_test_material.material_id}}?item_type=RM",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [404],
"jsonPath": {
"$.success": false
}
}
},
{
"id": "create_parent_product",
"name": "BOM 상위 제품 생성",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "FG",
"code": "TEST-BOM-PARENT-{{ts}}",
"name": "BOM 상위 제품",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"parent_id": "$.data.id"
}
},
{
"id": "create_child_material",
"name": "BOM 구성품용 자재 생성",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "RM",
"code": "TEST-BOM-CHILD-{{ts}}",
"name": "BOM 구성품 자재",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"child_material_id": "$.data.id",
"child_material_code": "$.data.code"
}
},
{
"id": "add_bom_component",
"name": "BOM 구성품 추가 (자재를 상위 제품에 연결)",
"method": "POST",
"endpoint": "/items/{{create_parent_product.parent_id}}/bom",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"items": [
{
"ref_type": "MATERIAL",
"ref_id": "{{create_child_material.child_material_id}}",
"quantity": 2,
"unit": "EA"
}
]
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true
}
}
},
{
"id": "delete_used_material",
"name": "사용 중인 자재 삭제 시도 (400 에러 - BOM 구성품)",
"method": "DELETE",
"endpoint": "/items/{{create_child_material.child_material_id}}?item_type=RM",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [400],
"jsonPath": {
"$.success": false
}
}
},
{
"id": "create_batch_products",
"name": "일괄 삭제용 제품 1 생성",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "FG",
"code": "TEST-BATCH-1-{{ts}}",
"name": "일괄삭제 테스트 1",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"batch_id_1": "$.data.id"
}
},
{
"id": "create_batch_products_2",
"name": "일괄 삭제용 제품 2 생성",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "FG",
"code": "TEST-BATCH-2-{{ts}}",
"name": "일괄삭제 테스트 2",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"batch_id_2": "$.data.id"
}
},
{
"id": "batch_delete_unused",
"name": "사용되지 않는 제품들 일괄 삭제 (성공)",
"method": "DELETE",
"endpoint": "/items/batch",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"item_type": "FG",
"ids": ["{{create_batch_products.batch_id_1}}", "{{create_batch_products_2.batch_id_2}}"]
},
"expect": {
"status": [200],
"jsonPath": {
"$.success": true
}
}
},
{
"id": "create_batch_for_fail",
"name": "일괄 삭제 실패 테스트용 제품 생성",
"method": "POST",
"endpoint": "/items",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"product_type": "FG",
"code": "TEST-BATCH-FAIL-{{ts}}",
"name": "일괄삭제 실패 테스트",
"unit": "EA",
"is_active": true
},
"expect": {
"status": [200, 201],
"jsonPath": {
"$.success": true,
"$.data.id": "@isNumber"
}
},
"extract": {
"batch_fail_id": "$.data.id"
}
},
{
"id": "batch_delete_with_used",
"name": "사용 중인 자재 일괄 삭제 시도 (400 에러)",
"method": "DELETE",
"endpoint": "/items/batch",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"item_type": "RM",
"ids": ["{{create_child_material.child_material_id}}"]
},
"expect": {
"status": [400],
"jsonPath": {
"$.success": false
}
}
},
{
"id": "cleanup_bom",
"name": "정리: BOM 구성품 전체 삭제 (빈 배열로 교체)",
"method": "POST",
"endpoint": "/items/{{create_parent_product.parent_id}}/bom/replace",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"body": {
"items": []
},
"expect": {
"status": [200, 201, 404]
}
},
{
"id": "cleanup_parent",
"name": "정리: 상위 제품 삭제",
"method": "DELETE",
"endpoint": "/items/{{create_parent_product.parent_id}}?item_type=FG",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [200, 404]
}
},
{
"id": "cleanup_child",
"name": "정리: 구성품 자재 삭제 (BOM 해제 후)",
"method": "DELETE",
"endpoint": "/items/{{create_child_material.child_material_id}}?item_type=RM",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [200, 404]
}
},
{
"id": "cleanup_batch_fail",
"name": "정리: 일괄삭제 테스트용 제품 삭제",
"method": "DELETE",
"endpoint": "/items/{{create_batch_for_fail.batch_fail_id}}?item_type=FG",
"headers": {
"Authorization": "Bearer {{login.token}}"
},
"expect": {
"status": [200, 404]
}
}
]
}