Initial Server project upload
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
param(
|
||||||
|
[string]$BaseUrl = "http://127.0.0.1:8082",
|
||||||
|
[string]$ApiToken = "atk_nKfVWLhMjL0RGSfRll3R_sdJS6IrIjuV"
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
$headers = @{
|
||||||
|
"X-Api-Token" = $ApiToken
|
||||||
|
"Accept" = "application/json"
|
||||||
|
}
|
||||||
|
|
||||||
|
function Invoke-ApiCheck {
|
||||||
|
param(
|
||||||
|
[string]$Name,
|
||||||
|
[string]$Path,
|
||||||
|
[string]$Method = "GET",
|
||||||
|
[object]$Body = $null
|
||||||
|
)
|
||||||
|
|
||||||
|
$uri = "$BaseUrl$Path"
|
||||||
|
$requestHeaders = @{} + $headers
|
||||||
|
$params = @{
|
||||||
|
Uri = $uri
|
||||||
|
Method = $Method
|
||||||
|
Headers = $requestHeaders
|
||||||
|
TimeoutSec = 8
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($null -ne $Body) {
|
||||||
|
$params.ContentType = "application/json"
|
||||||
|
$params.Body = ($Body | ConvertTo-Json -Depth 10 -Compress)
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$response = Invoke-RestMethod @params
|
||||||
|
Write-Host "[PASS] $Name"
|
||||||
|
return $response
|
||||||
|
} catch {
|
||||||
|
Write-Host "[FAIL] $Name - $($_.Exception.Message)"
|
||||||
|
throw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Invoke-ApiCheck "health" "/api/v1/system/health" | Out-Null
|
||||||
|
Invoke-ApiCheck "storage" "/api/v1/system/storage" | Out-Null
|
||||||
|
Invoke-ApiCheck "time" "/api/v1/system/time" | Out-Null
|
||||||
|
Invoke-ApiCheck "sync version" "/api/v1/sync/version" | Out-Null
|
||||||
|
Invoke-ApiCheck "sync state k210" "/api/v1/sync/state?client=k210&last_version=0" | Out-Null
|
||||||
|
Invoke-ApiCheck "sync state stm32" "/api/v1/sync/state?client=stm32&last_version=0" | Out-Null
|
||||||
|
Invoke-ApiCheck "records" "/api/v1/attendance/records?limit=10&offset=0" | Out-Null
|
||||||
|
Invoke-ApiCheck "statistics" "/api/v1/attendance/statistics" | Out-Null
|
||||||
|
Invoke-ApiCheck "time slots" "/api/v1/config/time-slots" | Out-Null
|
||||||
|
Invoke-ApiCheck "duplicate check" "/api/v1/attendance/duplicates?student_id=1&slot_start=00:00&slot_end=23:59" | Out-Null
|
||||||
|
Invoke-ApiCheck "today records" "/api/v1/attendance/today?slot_start=00:00&slot_end=23:59" | Out-Null
|
||||||
|
Invoke-ApiCheck "mapping config" "/api/v1/config/mappings" | Out-Null
|
||||||
|
Invoke-ApiCheck "face photos" "/api/v1/faces/photos" | Out-Null
|
||||||
|
Invoke-ApiCheck "face mappings" "/api/v1/faces/mappings" | Out-Null
|
||||||
|
Invoke-ApiCheck "student ids" "/api/v1/faces/student-ids" | Out-Null
|
||||||
|
Invoke-ApiCheck "pending deletes" "/api/v1/faces/pending-delete" | Out-Null
|
||||||
|
Invoke-ApiCheck "sync request" "/api/v1/sync/request" | Out-Null
|
||||||
|
|
||||||
|
Write-Host "All regression API checks passed."
|
||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user