func TestRESTHandler(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	// Setup the test server.
	mux := newMultiplexer(assert)
	ts := restaudit.StartServer(mux, assert)
	defer ts.Close()
	err := mux.Register("test", "rest", NewRESTHandler("rest", assert))
	assert.Nil(err)
	err = mux.Register("test", "double", NewDoubleHandler("double", assert))
	assert.Nil(err)
	// Perform test requests on rest handler.
	req := restaudit.NewRequest("POST", "/base/test/rest")
	resp := ts.DoRequest(req)
	resp.AssertBodyContains("CREATE test/rest")
	req = restaudit.NewRequest("GET", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("READ test/rest/12345")
	req = restaudit.NewRequest("PUT", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("UPDATE test/rest/12345")
	req = restaudit.NewRequest("PATCH", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("MODIFY test/rest/12345")
	req = restaudit.NewRequest("DELETE", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("DELETE test/rest/12345")
	req = restaudit.NewRequest("OPTIONS", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("INFO test/rest/12345")
	// Perform test requests on double handler.
	req = restaudit.NewRequest("GET", "/base/test/double/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("GET test/double/12345")
}
// TestRESTHandler tests the mapping of requests to the REST methods
// of a handler.
TestRESTHandler tests the mapping of requests to the REST methods
of a handler.
// TestRESTHandler tests the mapping of requests to the REST methods // of a handler .
func TestRESTHandler(t *testing.T) {
	assert := audit.NewTestingAssertion(t, true)
	mux := newMultiplexer(assert)
	ts := restaudit.StartServer(mux, assert)
	defer ts.Close()
	err := mux.Register("test", "rest", NewRESTHandler("rest", assert))
	assert.Nil(err)
	err = mux.Register("test", "double", NewDoubleHandler("double", assert))
	assert.Nil(err)
	req := restaudit.NewRequest("POST", "/base/test/rest")
	resp := ts.DoRequest(req)
	resp.AssertBodyContains("CREATE test/rest")
	req = restaudit.NewRequest("GET", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("READ test/rest/12345")
	req = restaudit.NewRequest("PUT", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("UPDATE test/rest/12345")
	req = restaudit.NewRequest("PATCH", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("MODIFY test/rest/12345")
	req = restaudit.NewRequest("DELETE", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("DELETE test/rest/12345")
	req = restaudit.NewRequest("OPTIONS", "/base/test/rest/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("INFO test/rest/12345")
	req = restaudit.NewRequest("GET", "/base/test/double/12345")
	resp = ts.DoRequest(req)
	resp.AssertBodyContains("GET test/double/12345")
}
func TestRESTHandler ( t * testing . T ) { assert := audit . NewTestingAssertion ( t , true ) mux := newMultiplexer ( assert ) ts := restaudit . StartServer ( mux , assert ) defer ts . Close ( ) err := mux . Register ( " " , " " , NewRESTHandler ( " " , assert ) ) assert . Nil ( err ) err = mux . Register ( " " , " " , NewDoubleHandler ( " " , assert ) ) assert . Nil ( err ) req := restaudit . NewRequest ( " " , " " ) resp := ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) req = restaudit . NewRequest ( " " , " " ) resp = ts . DoRequest ( req ) resp . AssertBodyContains ( " " ) }
TestRESTHandler tests the mapping of requests to the REST methods
of a handler.
TestRESTHandler tests the mapping of requests to the REST methods of a handler .
// Setup the test server. // Perform test requests on rest handler. // Perform test requests on double handler.