/usr/share/gocode/src/github.com/revel/revel/compress_test.go is in golang-github-revel-revel-dev 0.12.0+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | package revel
import (
"net/http/httptest"
"strings"
"testing"
)
// Test that the render response is as expected.
func TestBenchmarkCompressed(t *testing.T) {
startFakeBookingApp()
resp := httptest.NewRecorder()
c := NewController(NewRequest(showRequest), NewResponse(resp))
c.SetAction("Hotels", "Show")
Config.SetOption("results.compressed", "true")
result := Hotels{c}.Show(3)
result.Apply(c.Request, c.Response)
if !strings.Contains(resp.Body.String(), "300 Main St.") {
t.Errorf("Failed to find hotel address in action response:\n%s", resp.Body)
}
}
func BenchmarkRenderCompressed(b *testing.B) {
startFakeBookingApp()
resp := httptest.NewRecorder()
resp.Body = nil
c := NewController(NewRequest(showRequest), NewResponse(resp))
c.SetAction("Hotels", "Show")
Config.SetOption("results.compressed", "true")
b.ResetTimer()
hotels := Hotels{c}
for i := 0; i < b.N; i++ {
hotels.Show(3).Apply(c.Request, c.Response)
}
}
func BenchmarkRenderUnCompressed(b *testing.B) {
startFakeBookingApp()
resp := httptest.NewRecorder()
resp.Body = nil
c := NewController(NewRequest(showRequest), NewResponse(resp))
c.SetAction("Hotels", "Show")
Config.SetOption("results.compressed", "false")
b.ResetTimer()
hotels := Hotels{c}
for i := 0; i < b.N; i++ {
hotels.Show(3).Apply(c.Request, c.Response)
}
}
|