Semaphore/api/api_test.go
tom whiston cccc00d113 use dredd for api testing
add ci context docker deployment
update api docs
add some small fixes
2018-04-18 18:03:15 +00:00

34 lines
694 B
Go

package api
import (
"testing"
"github.com/go-openapi/loads"
"github.com/go-openapi/spec"
"github.com/go-openapi/validate"
"github.com/go-openapi/strfmt"
"os"
"log"
)
// TestApi Validates the api description in the root meets the swagger/openapi spec
func TestApiSchemaValidation(t *testing.T) {
dir, err := os.Getwd()
if err != nil {
log.Fatal(err)
}
fpath := dir+"/../api-docs.yml"
print(fpath)
document, err := loads.Spec(fpath)
if err != nil {
t.Fatal(err)
}
spc := spec.ExpandOptions{RelativeBase: fpath}
document, err = document.Expanded(&spc)
if err != nil {
t.Fatal(err)
}
if err := validate.Spec(document, strfmt.Default); err != nil {
t.Fatal(err)
}
}