dex/vendor/github.com/mbanzon/simplehttp/simplehttp_test.go

38 lines
699 B
Go
Raw Normal View History

2016-04-09 00:26:29 +05:30
package simplehttp
import (
"github.com/mbanzon/dummyserver"
"log"
"strconv"
"testing"
)
var (
server *dummyserver.DummyServer
dummyurl string
invalidurl string
)
type testStruct struct {
Value1 string `json:"value1" xml:"value1"`
Value2 string `json:"value2" xml:"value2"`
Value3 string `json:"value3" xml:"value3"`
}
func init() {
server = dummyserver.NewRandomServer()
go func() {
err := server.Start()
log.Fatal(err)
}()
dummyurl = "http://localhost:" + strconv.Itoa(server.GetPort()) + "/"
invalidurl = "invalid://invalid"
}
func TestAddParameters(t *testing.T) {
request := NewHTTPRequest(dummyurl)
request.AddParameter("p1", "v1")
request.MakeGetRequest()
}