MCPcopy
hub / github.com/revel/revel / TestBenchmarkCompressed

Function TestBenchmarkCompressed

compress_test.go:14–27  ·  view source on GitHub ↗

Test that the render response is as expected.

(t *testing.T)

Source from the content-addressed store, hash-verified

12
13// Test that the render response is as expected.
14func TestBenchmarkCompressed(t *testing.T) {
15 startFakeBookingApp()
16 resp := httptest.NewRecorder()
17 c := NewTestController(resp, showRequest)
18 if err := c.SetAction("Hotels", "Show"); err != nil {
19 t.Errorf("SetAction failed: %s", err)
20 }
21 Config.SetOption("results.compressed", "true")
22 result := Hotels{c}.Show(3)
23 result.Apply(c.Request, c.Response)
24 if !strings.Contains(resp.Body.String(), "300 Main St.") {
25 t.Errorf("Failed to find hotel address in action response:\n%s", resp.Body)
26 }
27}
28
29func BenchmarkRenderCompressed(b *testing.B) {
30 startFakeBookingApp()

Callers

nothing calls this directly

Calls 7

startFakeBookingAppFunction · 0.85
NewTestControllerFunction · 0.85
SetActionMethod · 0.80
ShowMethod · 0.80
ErrorfMethod · 0.65
ApplyMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected