Integrating goweb 1.4 and gae-go-testing (@tenntenn version)

33 views
Skip to first unread message

patto_chennai

unread,
Sep 17, 2012, 9:05:45 AM9/17/12
to golang...@googlegroups.com
Hey All,

Is anyone tempting to integrate unit testing from gae with unit test from goweb?

gae-go-testing create an implementation of an appengine context with a child process that contains a running instance of the devserver environment.  

I am not able to get the http to fire up a request that my goweb controllers catch ... any ideas?


Best

matryer

unread,
Sep 18, 2012, 7:26:48 AM9/18/12
to golang...@googlegroups.com
Hey

Are you setting the Content-Type?

If not, it will assume normal HTTP form encoding.  (see http://code.google.com/p/goweb/source/browse/goweb/decoders.go#62)

Mat

patto_chennai

unread,
Sep 18, 2012, 9:01:09 AM9/18/12
to golang...@googlegroups.com
Thanks for your reply.

Vladimir Mihailenco
 (on the appengine-go group) Suggested that I use : I did not use goweb, but in general you should be able to use http.DefaultServeMux: https://gist.github.com/3742087

w, err := httptest.Get(context, "/posts")

Which I did quite successfully, i.e. I now get the http call to be executed in the child context instance generated by gae-go-testing, I will now proceed to set up Content-Type.

I must say that prior to integrating gae-go-testing my initial test from a 'poster' to the goweb controller, Fill did not work even though I set the Content-Type will let you know. 

I see you also developed the gae-record package, are you using it in conjunction with goweb a lot?

Best


Come see us at Frankfurt Book Fair * Oct 10th -14th 2012 * Frankfurt, Germany * Hall 8.0 * Stand R924

patto_chennai

unread,
Sep 18, 2012, 3:13:58 PM9/18/12
to golang...@googlegroups.com
Mat,

I am now able to get the controller to fire, the content type seem good, but I am getting the following output

Test Entered

GOWEB CREATE

json: Unmarshal(non-pointer pcg_lib.Panchangam)

PASS

for the following code 

func (cr *MyPanchangamRessourceControl) Create(cx *goweb.Context) {

fmt.Printf("GOWEB CREATE\n")

var data = Panchangam{}

err := cx.Fill(data)

fmt.Printf(err.Error() + "\n")\

I have tried all combination on the data declaration, but to no avail. 

matryer

unread,
Sep 19, 2012, 4:06:13 PM9/19/12
to golang...@googlegroups.com
Try passing the address of 'data' to the Fill method like this:  cx.Fill(&data)

Mat

matryer

unread,
Sep 19, 2012, 4:07:43 PM9/19/12
to golang...@googlegroups.com
Hey

gae-record needs to be updated for Go1 - I'm using it in slightly older Go release instances and haven't had time to update it yet.

But feel free to use it, update it and let me know.

Mat
Reply all
Reply to author
Forward
0 new messages