forked from loafle/openapi-generator-original
add Go client test - TestPlaceOrder (#321)
This commit is contained in:
parent
91d6d77a09
commit
7126074f49
29
samples/client/petstore/go/store_api_test.go
Normal file
29
samples/client/petstore/go/store_api_test.go
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
sw "./go-petstore"
|
||||||
|
"golang.org/x/net/context"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestPlaceOrder(t *testing.T) {
|
||||||
|
newOrder := sw.Order{
|
||||||
|
Id: 0,
|
||||||
|
PetId: 0,
|
||||||
|
Quantity: 0,
|
||||||
|
ShipDate: time.Now().UTC(),
|
||||||
|
Status: "placed",
|
||||||
|
Complete: false}
|
||||||
|
|
||||||
|
_, r, err := client.StoreApi.PlaceOrder(context.Background(), newOrder)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Error while placing order")
|
||||||
|
t.Log(err)
|
||||||
|
}
|
||||||
|
if r.StatusCode != 200 {
|
||||||
|
t.Log(r)
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user