MCPcopy Create free account
hub / github.com/buggregator/server / TestSQLiteStore_Pin_Unpin

Function TestSQLiteStore_Pin_Unpin

internal/storage/sqlite_test.go:225–247  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

223}
224
225func TestSQLiteStore_Pin_Unpin(t *testing.T) {
226 db := setupTestDB(t)
227 store := storage.NewSQLiteStore(db)
228 ctx := context.Background()
229
230 store.Store(ctx, makeEvent("pin-1", "sentry", "default"))
231
232 if err := store.Pin(ctx, "pin-1"); err != nil {
233 t.Fatalf("Pin: %v", err)
234 }
235 found, _ := store.FindByUUID(ctx, "pin-1")
236 if !found.IsPinned {
237 t.Error("expected IsPinned to be true")
238 }
239
240 if err := store.Unpin(ctx, "pin-1"); err != nil {
241 t.Fatalf("Unpin: %v", err)
242 }
243 found, _ = store.FindByUUID(ctx, "pin-1")
244 if found.IsPinned {
245 t.Error("expected IsPinned to be false")
246 }
247}

Callers

nothing calls this directly

Calls 7

StoreMethod · 0.95
PinMethod · 0.95
FindByUUIDMethod · 0.95
UnpinMethod · 0.95
NewSQLiteStoreFunction · 0.92
makeEventFunction · 0.85
setupTestDBFunction · 0.70

Tested by

no test coverage detected