Hi,
New to golang and goweb but seriously loving both so far.
I am trying to test a little goweb API using the
goweb_test_helpers but am just not getting anywhere. The API works fine with curl...
HTTP/1.1 200 OK
Content-Type: application/json
Date: Tue, 23 Oct 2012 17:31:56 GMT
Transfer-Encoding: chunked
{"C":"","S":200,"D":[{"firstName":"Kevin","middleName":"G","lastName":"Fourie"}],"E":null}
My test func is as follows...
func TestUserById(t *testing.T) {
log.SetFlags(0)
log.Println("TEST UserById")
MakeTestContext("GET", testDomain+"/v1/users/508181cc2341ab4f5d3e704a")
assertResponse(t, "something")
assertResponseStatus(t, 200)
}
The output of 'go test' is...
$ go test
TEST UserById
currentResponse: &{0 map[]}
--- FAIL: TestUserById (0.00 seconds)
test_helpers.go:82: Response incorrect.
Expected: "something"
Actual: ""
test_helpers.go:53: HTTP status code expected to be 200, not 0
FAIL
What am I doing wrong?
Thanks
Kevin