@@ -278,21 +278,14 @@ func CreateDomainAuthWithRegID(t *testing.T, domainName string, sa *SQLStorageAu
278278 Expires : & exp ,
279279 Identifier : core.AcmeIdentifier {Type : core .IdentifierDNS , Value : domainName },
280280 RegistrationID : regID ,
281- Challenges : []core.Challenge {{}},
281+ Challenges : []core.Challenge {{Type : "simpleHttp" , Status : core . StatusValid , URI : domainName , Token : "THISWOULDNTBEAGOODTOKEN" }},
282282 Combinations : combos ,
283283 })
284284 if err != nil {
285285 t .Fatalf ("Couldn't create new pending authorization: %s" , err )
286286 }
287287 test .Assert (t , authz .ID != "" , "ID shouldn't be blank" )
288288
289- // prepare challenge for auth
290- chall := core.Challenge {Type : "simpleHttp" , Status : core .StatusValid , URI : domainName , Token : "THISWOULDNTBEAGOODTOKEN" }
291- // Add some challenges
292- authz .Challenges = []core.Challenge {chall }
293- err = sa .UpdatePendingAuthorization (ctx , authz )
294- test .AssertNotError (t , err , "Couldn't update pending authorization with ID " + authz .ID )
295-
296289 return
297290}
298291
@@ -1987,73 +1980,6 @@ func TestGetOrderForNames(t *testing.T) {
19871980 test .Assert (t , result == nil , "sa.GetOrderForNames returned non-nil result for finalized order case" )
19881981}
19891982
1990- func TestUpdatePendingAuthorizationInvalidOrder (t * testing.T ) {
1991- sa , fc , cleanUp := initSA (t )
1992- defer cleanUp ()
1993-
1994- expires := fc .Now ().Add (time .Hour )
1995- ctx := context .Background ()
1996-
1997- // Create a registration to work with
1998- reg := satest .CreateWorkingRegistration (t , sa )
1999-
2000- // Create a pending authz, not associated with any orders
2001- authz := core.Authorization {
2002- RegistrationID : reg .ID ,
2003- Expires : & expires ,
2004- Status : core .StatusPending ,
2005- Identifier : core.AcmeIdentifier {Type : core .IdentifierDNS , Value : "your.order.is.up" },
2006- }
2007- pendingAuthz , err := sa .NewPendingAuthorization (ctx , authz )
2008- test .AssertNotError (t , err , "Couldn't create new pending authorization" )
2009-
2010- // Update the pending authz to be invalid. This shouldn't error.
2011- pendingAuthz .Status = core .StatusInvalid
2012- err = sa .FinalizeAuthorization (ctx , pendingAuthz )
2013- test .AssertNotError (t , err , "Couldn't finalize legacy pending authz to invalid" )
2014-
2015- // Create a pending authz that will be associated with an order
2016- authz = core.Authorization {
2017- RegistrationID : reg .ID ,
2018- Expires : & expires ,
2019- Status : core .StatusPending ,
2020- Identifier : core.AcmeIdentifier {Type : core .IdentifierDNS , Value : "your.order.is.up" },
2021- }
2022- pendingAuthz , err = sa .NewPendingAuthorization (ctx , authz )
2023- test .AssertNotError (t , err , "Couldn't create new pending authorization" )
2024-
2025- // Add a new order that references the above pending authz
2026- expiresNano := expires .UnixNano ()
2027- order , err := sa .NewOrder (ctx , & corepb.Order {
2028- RegistrationID : & reg .ID ,
2029- Expires : & expiresNano ,
2030- Authorizations : []string {pendingAuthz .ID },
2031- Names : []string {"your.order.is.up" },
2032- })
2033- // It shouldn't error
2034- test .AssertNotError (t , err , "sa.NewOrder failed" )
2035- // The order ID shouldn't be nil
2036- test .AssertNotNil (t , * order .Id , "NewOrder returned with a nil Id" )
2037- // The order should be pending
2038- test .AssertEquals (t , * order .Status , string (core .StatusPending ))
2039- // The order should have one authz with the correct ID
2040- test .AssertEquals (t , len (order .Authorizations ), 1 )
2041- test .AssertEquals (t , order .Authorizations [0 ], pendingAuthz .ID )
2042-
2043- // Now finalize the authz to an invalid status.
2044- pendingAuthz .Status = core .StatusInvalid
2045- err = sa .FinalizeAuthorization (ctx , pendingAuthz )
2046- test .AssertNotError (t , err , "Couldn't finalize pending authz associated with order to invalid" )
2047-
2048- // Fetch the order to get its updated status
2049- updatedOrder , err := sa .GetOrder (
2050- context .Background (),
2051- & sapb.OrderRequest {Id : order .Id })
2052- test .AssertNotError (t , err , "GetOrder failed" )
2053- // We expect the updated order status to be invalid
2054- test .AssertEquals (t , * updatedOrder .Status , string (core .StatusInvalid ))
2055- }
2056-
20571983func TestStatusForOrder (t * testing.T ) {
20581984 sa , fc , cleanUp := initSA (t )
20591985 defer cleanUp ()
0 commit comments