(ta TestAccessor, t *testing.T)
| 315 | } |
| 316 | |
| 317 | func testInsertOCSPAndGetOCSP(ta TestAccessor, t *testing.T) { |
| 318 | ta.Truncate() |
| 319 | |
| 320 | expiry := time.Date(2010, time.December, 25, 23, 0, 0, 0, time.UTC) |
| 321 | want := certdb.OCSPRecord{ |
| 322 | Serial: "fake serial", |
| 323 | AKI: fakeAKI, |
| 324 | Body: "fake body", |
| 325 | Expiry: expiry, |
| 326 | } |
| 327 | setupGoodCert(ta, t, want) |
| 328 | |
| 329 | if err := ta.Accessor.InsertOCSP(want); err != nil { |
| 330 | t.Fatal(err) |
| 331 | } |
| 332 | |
| 333 | rets, err := ta.Accessor.GetOCSP(want.Serial, want.AKI) |
| 334 | if err != nil { |
| 335 | t.Fatal(err) |
| 336 | } |
| 337 | if len(rets) != 1 { |
| 338 | t.Fatal("should return exactly one record") |
| 339 | } |
| 340 | |
| 341 | got := rets[0] |
| 342 | |
| 343 | if want.Serial != got.Serial || want.Body != got.Body || |
| 344 | !roughlySameTime(want.Expiry, got.Expiry) { |
| 345 | t.Errorf("want OCSP %+v, got %+v", want, got) |
| 346 | } |
| 347 | |
| 348 | unexpired, err := ta.Accessor.GetUnexpiredOCSPs() |
| 349 | |
| 350 | if err != nil { |
| 351 | t.Fatal(err) |
| 352 | } |
| 353 | |
| 354 | if len(unexpired) != 0 { |
| 355 | t.Error("should not have unexpired certificate record") |
| 356 | } |
| 357 | } |
| 358 | |
| 359 | func testInsertOCSPAndGetUnexpiredOCSP(ta TestAccessor, t *testing.T) { |
| 360 | ta.Truncate() |
no test coverage detected
searching dependent graphs…