LingAdmin/Backend/LingAdmin.API/test-new-apis.ps1

55 lines
2.0 KiB
PowerShell
Raw Normal View History

2026-04-16 18:13:06 +08:00
# Test Inventory and Audit APIs
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Testing Inventory and Audit APIs" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Test Inventory Config
Write-Host "1. Testing Inventory Config API..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:5000/api/pages/inventory/config" -Method Get
Write-Host "✓ Inventory Config:" -ForegroundColor Green
$response.data | ConvertTo-Json -Depth 10
} catch {
Write-Host "✗ Error: $_" -ForegroundColor Red
}
Write-Host ""
# Test Inventory Data
Write-Host "2. Testing Inventory Data API..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:5000/api/inventory" -Method Get
Write-Host "✓ Inventory Data (${response.data.Count} items):" -ForegroundColor Green
$response.data | Format-Table -AutoSize
} catch {
Write-Host "✗ Error: $_" -ForegroundColor Red
}
Write-Host ""
# Test Audit Config
Write-Host "3. Testing Audit Config API..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:5000/api/pages/audit/config" -Method Get
Write-Host "✓ Audit Config:" -ForegroundColor Green
$response.data | ConvertTo-Json -Depth 10
} catch {
Write-Host "✗ Error: $_" -ForegroundColor Red
}
Write-Host ""
# Test Audit Data
Write-Host "4. Testing Audit Data API..." -ForegroundColor Yellow
try {
$response = Invoke-RestMethod -Uri "http://localhost:5000/api/audit" -Method Get
Write-Host "✓ Audit Data (${response.data.Count} logs):" -ForegroundColor Green
$response.data | Format-Table -AutoSize
} catch {
Write-Host "✗ Error: $_" -ForegroundColor Red
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Test Complete!" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan