You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
microsrv/main_test.go

39 lines
785 B
Go

package main
import (
"fmt"
"microsrv/client/client"
"microsrv/client/client/products"
"testing"
)
func TestClient(t *testing.T) {
cfg := client.DefaultTransportConfig().WithHost("localhost:9090")
c := client.NewHTTPClientWithConfig(nil, cfg)
prodParams := products.NewGetProductParams()
prod, err := c.Products.GetProduct(prodParams)
if err != nil {
t.Fatal(err)
}
prodsParams := products.NewGetProductsParams()
prods, errs := c.Products.GetProducts(prodsParams)
if errs != nil {
t.Fatal(errs)
}
fmt.Println(prod)
fmt.Println(prods)
fmt.Printf("%#v", prod.GetPayload())
fmt.Println("")
fmt.Printf("%#v", prods.GetPayload()[3])
fmt.Println("")
//Remove if you don't want to debug
//Aka if you actually want to test
//Lmao
//Nobody tests
//t.Fail()
}