(ta TestAccessor, t *testing.T)
| 357 | } |
| 358 | |
| 359 | func testInsertOCSPAndGetUnexpiredOCSP(ta TestAccessor, t *testing.T) { |
| 360 | ta.Truncate() |
| 361 | |
| 362 | want := certdb.OCSPRecord{ |
| 363 | Serial: "fake serial 2", |
| 364 | AKI: fakeAKI, |
| 365 | Body: "fake body", |
| 366 | Expiry: time.Now().Add(time.Minute), |
| 367 | } |
| 368 | setupGoodCert(ta, t, want) |
| 369 | |
| 370 | if err := ta.Accessor.InsertOCSP(want); err != nil { |
| 371 | t.Fatal(err) |
| 372 | } |
| 373 | |
| 374 | rets, err := ta.Accessor.GetOCSP(want.Serial, want.AKI) |
| 375 | if err != nil { |
| 376 | t.Fatal(err) |
| 377 | } |
| 378 | if len(rets) != 1 { |
| 379 | t.Fatal("should return exactly one record") |
| 380 | } |
| 381 | |
| 382 | got := rets[0] |
| 383 | |
| 384 | if want.Serial != got.Serial || want.Body != got.Body || |
| 385 | !roughlySameTime(want.Expiry, got.Expiry) { |
| 386 | t.Errorf("want OCSP %+v, got %+v", want, got) |
| 387 | } |
| 388 | |
| 389 | unexpired, err := ta.Accessor.GetUnexpiredOCSPs() |
| 390 | |
| 391 | if err != nil { |
| 392 | t.Fatal(err) |
| 393 | } |
| 394 | |
| 395 | if len(unexpired) != 1 { |
| 396 | t.Error("should not have other than 1 unexpired certificate record:", len(unexpired)) |
| 397 | } |
| 398 | } |
| 399 | |
| 400 | func testUpdateOCSPAndGetOCSP(ta TestAccessor, t *testing.T) { |
| 401 | ta.Truncate() |
no test coverage detected
searching dependent graphs…