MCPcopy
hub / github.com/perkeep/perkeep / TestParseStatResponse

Function TestParseStatResponse

pkg/client/stat_test.go:44–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

42`
43
44func TestParseStatResponse(t *testing.T) {
45 res, err := parseStatResponse(&http.Response{
46 Body: io.NopCloser(strings.NewReader(response)),
47 })
48 if err != nil {
49 t.Fatal(err)
50 }
51 hm := res.HaveMap
52 res.HaveMap = nil
53 want := &statResponse{
54 HaveMap: nil,
55 canLongPoll: true,
56 }
57 if !reflect.DeepEqual(want, res) {
58 t.Errorf(" Got: %#v\nWant: %#v", res, want)
59 }
60
61 if sb, ok := hm["foo-abcd"]; !ok || sb.Size != 123 {
62 t.Errorf("Got unexpected map: %#v", hm)
63 }
64
65 if sb, ok := hm["foo-cdef"]; !ok || sb.Size != 999 {
66 t.Errorf("Got unexpected map: %#v", hm)
67 }
68}

Callers

nothing calls this directly

Calls 2

parseStatResponseFunction · 0.85
FatalMethod · 0.80

Tested by

no test coverage detected