feat: add realtime snapshot and location APIs
This commit is contained in:
25
go/vehicle-gateway/internal/realtime/openapi_test.go
Normal file
25
go/vehicle-gateway/internal/realtime/openapi_test.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package realtime
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOpenAPIHandlerDocumentsRealtimeSnapshotAndLocation(t *testing.T) {
|
||||
request := httptest.NewRequest(http.MethodGet, "/openapi.json", nil)
|
||||
response := httptest.NewRecorder()
|
||||
|
||||
NewOpenAPIHandler().ServeHTTP(response, request)
|
||||
|
||||
if response.Code != http.StatusOK {
|
||||
t.Fatalf("status = %d body=%s", response.Code, response.Body.String())
|
||||
}
|
||||
body := response.Body.String()
|
||||
for _, want := range []string{`"/api/realtime/snapshots"`, `"/api/realtime/locations"`, `"vehicle_realtime_snapshot"`, `"vehicle_realtime_location"`} {
|
||||
if !strings.Contains(body, want) {
|
||||
t.Fatalf("openapi missing %s: %s", want, body)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user