Mariano Cano 4 лет назад
Родитель
Сommit
c77b4ff9c5
4 измененных файлов с 13 добавлено и 9 удалено
  1. 9 6
      acme/api/account_test.go
  2. 1 1
      acme/api/order_test.go
  3. 2 2
      acme/common.go
  4. 1 0
      authority/provisioner/acme.go

+ 9 - 6
acme/api/account_test.go

@@ -41,12 +41,15 @@ func (*fakeProvisioner) AuthorizeSign(ctx context.Context, token string) ([]prov
 	return nil, nil
 }
 
-func (*fakeProvisioner) AuthorizeRevoke(ctx context.Context, token string) error        { return nil }
-func (*fakeProvisioner) AuthorizeChallenge(ctx context.Context, challenge string) error { return nil }
-func (*fakeProvisioner) GetID() string                                                  { return "" }
-func (*fakeProvisioner) GetName() string                                                { return "" }
-func (*fakeProvisioner) DefaultTLSCertDuration() time.Duration                          { return 0 }
-func (*fakeProvisioner) GetOptions() *provisioner.Options                               { return nil }
+func (*fakeProvisioner) AuthorizeChallenge(ctx context.Context, challenge provisioner.ACMEChallenge) error {
+	return nil
+}
+
+func (*fakeProvisioner) AuthorizeRevoke(ctx context.Context, token string) error { return nil }
+func (*fakeProvisioner) GetID() string                                           { return "" }
+func (*fakeProvisioner) GetName() string                                         { return "" }
+func (*fakeProvisioner) DefaultTLSCertDuration() time.Duration                   { return 0 }
+func (*fakeProvisioner) GetOptions() *provisioner.Options                        { return nil }
 
 func newProv() acme.Provisioner {
 	// Initialize provisioners

+ 1 - 1
acme/api/order_test.go

@@ -725,7 +725,7 @@ func TestHandler_newAuthorization(t *testing.T) {
 				ExpiresAt: clock.Now(),
 			}
 			deviceAttestProv := newProv()
-			deviceAttestProv.(*provisioner.ACME).Challenges = []string{string(acme.DEVICEATTEST01)}
+			deviceAttestProv.(*provisioner.ACME).Challenges = []provisioner.ACMEChallenge{provisioner.DEVICE_ATTEST_01}
 			return test{
 				prov: deviceAttestProv,
 				db: &acme.MockDB{

+ 2 - 2
acme/common.go

@@ -110,7 +110,7 @@ type MockProvisioner struct {
 	MauthorizeOrderIdentifier func(ctx context.Context, identifier provisioner.ACMEIdentifier) error
 	MauthorizeSign            func(ctx context.Context, ott string) ([]provisioner.SignOption, error)
 	MauthorizeRevoke          func(ctx context.Context, token string) error
-	MauthorizeChallenge       func(Ctx context.Context, challenge string) error
+	MauthorizeChallenge       func(Ctx context.Context, challenge provisioner.ACMEChallenge) error
 	MdefaultTLSCertDuration   func() time.Duration
 	MgetOptions               func() *provisioner.Options
 }
@@ -148,7 +148,7 @@ func (m *MockProvisioner) AuthorizeRevoke(ctx context.Context, token string) err
 }
 
 // AuthorizeChallenge mock
-func (m *MockProvisioner) AuthorizeChallenge(ctx context.Context, challenge string) error {
+func (m *MockProvisioner) AuthorizeChallenge(ctx context.Context, challenge provisioner.ACMEChallenge) error {
 	if m.MauthorizeChallenge != nil {
 		return m.MauthorizeChallenge(ctx, challenge)
 	}

+ 1 - 0
authority/provisioner/acme.go

@@ -14,6 +14,7 @@ import (
 // ACMEChallenge represents the supported acme challenges.
 type ACMEChallenge string
 
+// nolint:revive // better names
 const (
 	// HTTP_01 is the http-01 ACME challenge.
 	HTTP_01 ACMEChallenge = "http-01"