@@ -2364,40 +2364,6 @@ func TestRehydrateHostPort(t *testing.T) {
23642364 test .AssertError (t , err , "URL field cannot be empty" )
23652365}
23662366
2367- func TestCountPendingAuthorizations2 (t * testing.T ) {
2368- sa , fc := initSA (t )
2369-
2370- reg := createWorkingRegistration (t , sa )
2371- expiresA := fc .Now ().Add (time .Hour ).UTC ()
2372- expiresB := fc .Now ().Add (time .Hour * 3 ).UTC ()
2373- _ = createPendingAuthorization (t , sa , reg .Id , identifier .NewDNS ("example.com" ), expiresA )
2374- _ = createPendingAuthorization (t , sa , reg .Id , identifier .NewDNS ("example.com" ), expiresB )
2375-
2376- // Registration has two new style pending authorizations
2377- regID := reg .Id
2378- count , err := sa .CountPendingAuthorizations2 (context .Background (), & sapb.RegistrationID {
2379- Id : regID ,
2380- })
2381- test .AssertNotError (t , err , "sa.CountPendingAuthorizations2 failed" )
2382- test .AssertEquals (t , count .Count , int64 (2 ))
2383-
2384- // Registration has two new style pending authorizations, one of which has expired
2385- fc .Add (time .Hour * 2 )
2386- count , err = sa .CountPendingAuthorizations2 (context .Background (), & sapb.RegistrationID {
2387- Id : regID ,
2388- })
2389- test .AssertNotError (t , err , "sa.CountPendingAuthorizations2 failed" )
2390- test .AssertEquals (t , count .Count , int64 (1 ))
2391-
2392- // Registration with no authorizations should be 0
2393- noReg := reg .Id + 100
2394- count , err = sa .CountPendingAuthorizations2 (context .Background (), & sapb.RegistrationID {
2395- Id : noReg ,
2396- })
2397- test .AssertNotError (t , err , "sa.CountPendingAuthorizations2 failed" )
2398- test .AssertEquals (t , count .Count , int64 (0 ))
2399- }
2400-
24012367func TestAuthzModelMapToPB (t * testing.T ) {
24022368 baseExpires := time .Now ()
24032369 input := map [identifier.ACMEIdentifier ]authzModel {
@@ -2554,38 +2520,6 @@ func TestGetOrderAuthorizations(t *testing.T) {
25542520 }
25552521}
25562522
2557- func TestCountInvalidAuthorizations2 (t * testing.T ) {
2558- sa , fc := initSA (t )
2559-
2560- fc .Add (time .Hour )
2561- reg := createWorkingRegistration (t , sa )
2562- idents := identifier.ACMEIdentifiers {
2563- identifier .NewDNS ("aaa" ),
2564- identifier .NewIP (netip .MustParseAddr ("10.10.10.10" )),
2565- }
2566- for _ , ident := range idents {
2567- // Create two authorizations, one pending, one invalid
2568- expiresA := fc .Now ().Add (time .Hour ).UTC ()
2569- expiresB := fc .Now ().Add (time .Hour * 3 ).UTC ()
2570- attemptedAt := fc .Now ()
2571- _ = createFinalizedAuthorization (t , sa , reg .Id , ident , expiresA , "invalid" , attemptedAt )
2572- _ = createPendingAuthorization (t , sa , reg .Id , ident , expiresB )
2573-
2574- earliest := fc .Now ().Add (- time .Hour ).UTC ()
2575- latest := fc .Now ().Add (time .Hour * 5 ).UTC ()
2576- count , err := sa .CountInvalidAuthorizations2 (context .Background (), & sapb.CountInvalidAuthorizationsRequest {
2577- RegistrationID : reg .Id ,
2578- Identifier : ident .ToProto (),
2579- Range : & sapb.Range {
2580- Earliest : timestamppb .New (earliest ),
2581- Latest : timestamppb .New (latest ),
2582- },
2583- })
2584- test .AssertNotError (t , err , "sa.CountInvalidAuthorizations2 failed" )
2585- test .AssertEquals (t , count .Count , int64 (1 ))
2586- }
2587- }
2588-
25892523func TestGetValidAuthorizations2 (t * testing.T ) {
25902524 sa , fc := initSA (t )
25912525
0 commit comments