revel/revel — pull request #810 by anonx (2014-11-25 10:44:42+00:00)
Title: Provide a way to extend testsuite

This is a fix for #791 which makes it possible to define own TestSuite methods as follows:
```go
// TestSuite is a struct I have defined in my tests/apptest.go
type TestSuite struct {
revel.TestSuite
}

// PutCustom is some method I need but it is not defined the way I want in Revel's
// testing package. So I'm redefining it myself.
func (t *TestSuite) PutCustom(path string, contentType string, reader io.Reader) *TestRequest {
req, err := http.NewRequest("PUT", t.BaseUrl() + path, reader)

// TODO: the behaviour I want here...

return t.NewTestRequest(req)
}
```
Now I can use my own ``PutCustom`` in methods of ``TestSuite`` I have defined. It will return the ``http.Request``'s wrapper which has ``Send`` method. So it can be used as follows:
```go
func (t *TestSuite) TestThatIndexPageWorks() {
// ...
req := t.PutCustom("/", "application/x-www-form-urlencoded", r)
req.URL.Opaque = ... // Some manipulations with the request.
req.Send()
}
```