forked from loafle/openapi-generator-original
* [Go][Client] Ensure test errors don't crash Previously we did not interrupt execution of a test case when an error was returned from an API call. This was causing the tests to crash as soon as we try to dereference the response. We now fail the tests as soon as the first API error is received. * [Go][Client] Use configured Scheme and Host in requests Previously we were simply setting the Host header and completely ignoring the configured scheme.
29 lines
707 B
Go
29 lines
707 B
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
|
|
sw "./go-petstore"
|
|
"golang.org/x/net/context"
|
|
)
|
|
|
|
// TestPutBodyWithFileSchema ensures a model with the name 'File'
|
|
// gets converted properly to the petstore.File struct vs. *os.File
|
|
// as specified in typeMapping for 'File'.
|
|
func TestPutBodyWithFileSchema(t *testing.T) {
|
|
return // early return to test compilation
|
|
|
|
schema := sw.FileSchemaTestClass{
|
|
File: sw.File{SourceURI: "https://example.com/image.png"},
|
|
Files: []sw.File{{SourceURI: "https://example.com/image.png"}}}
|
|
|
|
r, err := client.FakeApi.TestBodyWithFileSchema(context.Background(), schema)
|
|
|
|
if err != nil {
|
|
t.Fatalf("Error while adding pet: %v", err)
|
|
}
|
|
if r.StatusCode != 200 {
|
|
t.Log(r)
|
|
}
|
|
}
|