-
Jamie Tanna authored
Adapted from BSD0 licensed https://gist.github.com/bojanz/00187fd502b75001953d200c11dbbd97, we can create test helpers for validating that OpenAPI are still met by HTTP request/responses in our `net/http` tests. This removes a couple of things from that code, as well as makes it more resilient for a few cases I've hit, such as the `Servers` array being matched correctly, and ensures that response headers are validated. This uses the [federated-api-model]'s OpenAPI contract, the Petstore example, and some hand-crafted examples. This follows best practices for CI/CD from micropub-go. We use an interface, `testingT` to allow for easier stubbing in unit tests. As `testing.T`'s interface requires using non-pointer methods, we need to use `state` as a pointer, so we can update i.e. `errored`. [federated-api-model]: https://github.com/co-cddo/federated-api-model
0c7572e7
This project is licensed under the Apache License 2.0.
Learn more