MCPcopy Create free account
hub / github.com/evilsocket/sum / TestWrappedRecordsAll

Function TestWrappedRecordsAll

wrapper/records_test.go:145–171  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

143}
144
145func TestWrappedRecordsAll(t *testing.T) {
146 setupRecords(t, true)
147 defer teardownRecords(t)
148
149 records, err := storage.LoadRecords(testFolder)
150 if err != nil {
151 t.Fatal(err)
152 }
153
154 wrapped := WrapRecords(records)
155 all := wrapped.All()
156 if len(all) != testRecords {
157 t.Fatalf("expected %d wrapped records, got %d", testRecords, len(all))
158 }
159
160 for _, wRec := range all {
161 err := records.ForEach(func(m proto.Message) error {
162 if reflect.DeepEqual(m.(*pb.Record), wRec.record) {
163 return errFound
164 }
165 return nil
166 })
167 if err != errFound {
168 t.Fatalf("record %d not wrapped correctly", wRec.ID)
169 }
170 }
171}
172
173func TestWrappedRecordsAllBut(t *testing.T) {
174 setupRecords(t, true)

Callers

nothing calls this directly

Calls 5

WrapRecordsFunction · 0.85
AllMethod · 0.80
ForEachMethod · 0.80
setupRecordsFunction · 0.70
teardownRecordsFunction · 0.70

Tested by

no test coverage detected