From b5eab009b260e3600683a54ac4439fbc943504f6 Mon Sep 17 00:00:00 2001 From: Mariano Cano Date: Tue, 5 May 2020 17:46:22 -0700 Subject: [PATCH] Rename method to NewEmbedded --- authority/authority.go | 6 +++--- authority/authority_test.go | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/authority/authority.go b/authority/authority.go index 6595427f..411787b6 100644 --- a/authority/authority.go +++ b/authority/authority.go @@ -85,9 +85,9 @@ func New(config *Config, opts ...Option) (*Authority, error) { return a, nil } -// NewEmbeddedAuthority initializes an authority that can be embedded in a -// different project without the limitations of the config. -func NewEmbeddedAuthority(opts ...Option) (*Authority, error) { +// NewEmbedded initializes an authority that can be embedded in a different +// project without the limitations of the config. +func NewEmbedded(opts ...Option) (*Authority, error) { config := &Config{ DNSNames: []string{"localhost", "127.0.0.1", "::1"}, AuthorityConfig: defaultAuthConfig, diff --git a/authority/authority_test.go b/authority/authority_test.go index 9daf4d03..b8cab30c 100644 --- a/authority/authority_test.go +++ b/authority/authority_test.go @@ -189,7 +189,7 @@ func TestAuthority_GetDatabase(t *testing.T) { } } -func TestNewEmbeddedAuthority(t *testing.T) { +func TestNewEmbedded(t *testing.T) { caPEM, err := ioutil.ReadFile("testdata/certs/root_ca.crt") assert.FatalError(t, err) @@ -246,9 +246,9 @@ func TestNewEmbeddedAuthority(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := NewEmbeddedAuthority(tt.args.opts...) + got, err := NewEmbedded(tt.args.opts...) if (err != nil) != tt.wantErr { - t.Errorf("NewEmbeddedAuthority() error = %v, wantErr %v", err, tt.wantErr) + t.Errorf("NewEmbedded() error = %v, wantErr %v", err, tt.wantErr) return } if err == nil { @@ -261,7 +261,7 @@ func TestNewEmbeddedAuthority(t *testing.T) { } } -func TestNewEmbeddedAuthority_Sign(t *testing.T) { +func TestNewEmbedded_Sign(t *testing.T) { caPEM, err := ioutil.ReadFile("testdata/certs/root_ca.crt") assert.FatalError(t, err) @@ -270,7 +270,7 @@ func TestNewEmbeddedAuthority_Sign(t *testing.T) { key, err := pemutil.Read("testdata/secrets/intermediate_ca_key", pemutil.WithPassword([]byte("pass"))) assert.FatalError(t, err) - a, err := NewEmbeddedAuthority(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))) + a, err := NewEmbedded(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))) assert.FatalError(t, err) // Sign @@ -287,7 +287,7 @@ func TestNewEmbeddedAuthority_Sign(t *testing.T) { assert.Equals(t, crt, cert[1]) } -func TestNewEmbeddedAuthority_GetTLSCertificate(t *testing.T) { +func TestNewEmbedded_GetTLSCertificate(t *testing.T) { caPEM, err := ioutil.ReadFile("testdata/certs/root_ca.crt") assert.FatalError(t, err) @@ -296,7 +296,7 @@ func TestNewEmbeddedAuthority_GetTLSCertificate(t *testing.T) { key, err := pemutil.Read("testdata/secrets/intermediate_ca_key", pemutil.WithPassword([]byte("pass"))) assert.FatalError(t, err) - a, err := NewEmbeddedAuthority(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))) + a, err := NewEmbedded(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))) assert.FatalError(t, err) // GetTLSCertificate