@@ -258,14 +258,6 @@ var (
258258
259259var ctx = context .Background ()
260260
261- func newAcctKey (t * testing.T ) []byte {
262- key , _ := ecdsa .GenerateKey (elliptic .P256 (), rand .Reader )
263- jwk := & jose.JSONWebKey {Key : key .Public ()}
264- acctKey , err := jwk .MarshalJSON ()
265- test .AssertNotError (t , err , "failed to marshal account key" )
266- return acctKey
267- }
268-
269261func initAuthorities (t * testing.T ) (* DummyValidationAuthority , sapb.StorageAuthorityClient , * RegistrationAuthorityImpl , ratelimits.Source , clock.FakeClock , func ()) {
270262 err := json .Unmarshal (AccountKeyJSONA , & AccountKeyA )
271263 test .AssertNotError (t , err , "Failed to unmarshal public JWK" )
@@ -464,66 +456,6 @@ func TestNewRegistration(t *testing.T) {
464456 test .AssertByteEquals (t , reg .Key , acctKeyB )
465457}
466458
467- func TestNewRegistrationContactsPresent (t * testing.T ) {
468- _ , _ , ra , _ , _ , cleanUp := initAuthorities (t )
469- defer cleanUp ()
470- testCases := []struct {
471- Name string
472- Reg * corepb.Registration
473- ExpectedErr error
474- }{
475- {
476- Name : "No contacts provided by client ContactsPresent false" ,
477- Reg : & corepb.Registration {
478- Key : newAcctKey (t ),
479- },
480- ExpectedErr : nil ,
481- },
482- {
483- Name : "Empty contact provided by client ContactsPresent true" ,
484- Reg : & corepb.Registration {
485- Contact : []string {},
486- ContactsPresent : true ,
487- Key : newAcctKey (t ),
488- },
489- ExpectedErr : nil ,
490- },
491- {
492- Name : "Valid contact provided by client ContactsPresent true" ,
493- Reg : & corepb.Registration {
494- Contact : []string {"mailto:foo@letsencrypt.org" },
495- ContactsPresent : true ,
496- Key : newAcctKey (t ),
497- },
498- ExpectedErr : nil ,
499- },
500- {
501- Name : "Valid contact provided by client ContactsPresent false" ,
502- Reg : & corepb.Registration {
503- Contact : []string {"mailto:foo@letsencrypt.org" },
504- ContactsPresent : false ,
505- Key : newAcctKey (t ),
506- },
507- ExpectedErr : fmt .Errorf ("account contacts present but contactsPresent false" ),
508- },
509- }
510- // For each test case we check that the NewRegistration works as
511- // intended with variations of Contact and ContactsPresent fields
512- for _ , tc := range testCases {
513- t .Run (tc .Name , func (t * testing.T ) {
514- // Create new registration
515- _ , err := ra .NewRegistration (ctx , tc .Reg )
516- // Check error output
517- if tc .ExpectedErr == nil {
518- test .AssertNotError (t , err , "expected no error for NewRegistration" )
519- } else {
520- test .AssertError (t , err , "expected error for NewRegistration" )
521- test .AssertEquals (t , err .Error (), tc .ExpectedErr .Error ())
522- }
523- })
524- }
525- }
526-
527459type mockSAFailsNewRegistration struct {
528460 sapb.StorageAuthorityClient
529461}
0 commit comments