MCPcopy Create free account
hub / github.com/GoogleChrome/webstatus.dev / Get

Method Get

backend/pkg/httpserver/cache_test.go:107–126  ·  view source on GitHub ↗

Get implements the Get method of the RawBytesDataCacher interface.

(_ context.Context, key string)

Source from the content-addressed store, hash-verified

105
106// Get implements the Get method of the RawBytesDataCacher interface.
107func (m *MockRawBytesDataCacher) Get(_ context.Context, key string) ([]byte, error) {
108 if m.currentGetCallIdx >= len(m.expectedGetCalls) {
109 m.t.Errorf("unexpected call to Get with key: %s", key)
110
111 return nil, nil
112 }
113
114 expectedCall := m.expectedGetCalls[m.currentGetCallIdx]
115 if expectedCall.Key != key {
116 m.t.Errorf("expected Get key: %s, got: %s", expectedCall.Key, key)
117 }
118
119 m.actualGetCalls = append(m.actualGetCalls, &ActualGetCall{
120 Key: key,
121 })
122
123 m.currentGetCallIdx++
124
125 return expectedCall.Value, expectedCall.Err
126}
127
128// AssertExpectations asserts that all expected calls were made.
129func (m *MockRawBytesDataCacher) AssertExpectations() {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected