1
0
Fork 0
mirror of https://github.com/Luzifer/share.git synced 2024-12-26 05:21:19 +00:00
share/vendor/github.com/aws/aws-sdk-go/service/machinelearning/customizations_test.go

40 lines
990 B
Go
Raw Normal View History

2017-12-02 14:25:54 +00:00
package machinelearning_test
import (
"bytes"
"io/ioutil"
"net/http"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/machinelearning"
)
func TestPredictEndpoint(t *testing.T) {
ml := machinelearning.New(unit.Session)
ml.Handlers.Send.Clear()
ml.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: 200,
Header: http.Header{},
Body: ioutil.NopCloser(bytes.NewReader([]byte("{}"))),
}
})
req, _ := ml.PredictRequest(&machinelearning.PredictInput{
PredictEndpoint: aws.String("https://localhost/endpoint"),
MLModelId: aws.String("id"),
Record: map[string]*string{},
})
err := req.Send()
if err != nil {
t.Errorf("expect no error, got %v", err)
}
if e, a := "https://localhost/endpoint", req.HTTPRequest.URL.String(); e != a {
t.Errorf("expect %v, got %v", e, a)
}
}