cli/command/image: notaryClientProvider: don't require arguments
This interface is used in tests to provide a dummy notary client, but none of the tests require any arguments, so let's remove them. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -12,14 +12,13 @@ import (
|
||||
"github.com/docker/cli/cli/context/store"
|
||||
manifeststore "github.com/docker/cli/cli/manifest/store"
|
||||
"github.com/docker/cli/cli/streams"
|
||||
"github.com/docker/cli/cli/trust"
|
||||
"github.com/docker/cli/internal/registryclient"
|
||||
"github.com/moby/moby/client"
|
||||
notaryclient "github.com/theupdateframework/notary/client"
|
||||
)
|
||||
|
||||
// NotaryClientFuncType defines a function that returns a fake notary client
|
||||
type NotaryClientFuncType func(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error)
|
||||
type NotaryClientFuncType func() (notaryclient.Repository, error)
|
||||
|
||||
// FakeCli emulates the default DockerCli
|
||||
type FakeCli struct {
|
||||
@ -169,9 +168,9 @@ func (c *FakeCli) SetNotaryClient(notaryClientFunc NotaryClientFuncType) {
|
||||
}
|
||||
|
||||
// NotaryClient returns an err for testing unless defined
|
||||
func (c *FakeCli) NotaryClient(imgRefAndAuth trust.ImageRefAndAuth, actions []string) (notaryclient.Repository, error) {
|
||||
func (c *FakeCli) NotaryClient() (notaryclient.Repository, error) {
|
||||
if c.notaryClientFunc != nil {
|
||||
return c.notaryClientFunc(imgRefAndAuth, actions)
|
||||
return c.notaryClientFunc()
|
||||
}
|
||||
return nil, errors.New("no notary client available unless defined")
|
||||
}
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package notary
|
||||
|
||||
import (
|
||||
"github.com/docker/cli/cli/trust"
|
||||
"github.com/theupdateframework/notary/client"
|
||||
"github.com/theupdateframework/notary/client/changelist"
|
||||
"github.com/theupdateframework/notary/cryptoservice"
|
||||
@ -12,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
// GetOfflineNotaryRepository returns a OfflineNotaryRepository
|
||||
func GetOfflineNotaryRepository(trust.ImageRefAndAuth, []string) (client.Repository, error) {
|
||||
func GetOfflineNotaryRepository() (client.Repository, error) {
|
||||
return OfflineNotaryRepository{}, nil
|
||||
}
|
||||
|
||||
@ -146,7 +145,7 @@ func (OfflineNotaryRepository) GetGUN() data.GUN {
|
||||
}
|
||||
|
||||
// GetUninitializedNotaryRepository returns an UninitializedNotaryRepository
|
||||
func GetUninitializedNotaryRepository(trust.ImageRefAndAuth, []string) (client.Repository, error) {
|
||||
func GetUninitializedNotaryRepository() (client.Repository, error) {
|
||||
return UninitializedNotaryRepository{}, nil
|
||||
}
|
||||
|
||||
@ -207,7 +206,7 @@ func (UninitializedNotaryRepository) RotateKey(data.RoleName, bool, []string) er
|
||||
}
|
||||
|
||||
// GetEmptyTargetsNotaryRepository returns an EmptyTargetsNotaryRepository
|
||||
func GetEmptyTargetsNotaryRepository(trust.ImageRefAndAuth, []string) (client.Repository, error) {
|
||||
func GetEmptyTargetsNotaryRepository() (client.Repository, error) {
|
||||
return EmptyTargetsNotaryRepository{}, nil
|
||||
}
|
||||
|
||||
@ -285,7 +284,7 @@ func (EmptyTargetsNotaryRepository) RotateKey(data.RoleName, bool, []string) err
|
||||
}
|
||||
|
||||
// GetLoadedNotaryRepository returns a LoadedNotaryRepository
|
||||
func GetLoadedNotaryRepository(trust.ImageRefAndAuth, []string) (client.Repository, error) {
|
||||
func GetLoadedNotaryRepository() (client.Repository, error) {
|
||||
return LoadedNotaryRepository{}, nil
|
||||
}
|
||||
|
||||
@ -511,7 +510,7 @@ func (l LoadedNotaryRepository) GetCryptoService() signed.CryptoService {
|
||||
}
|
||||
|
||||
// GetLoadedWithNoSignersNotaryRepository returns a LoadedWithNoSignersNotaryRepository
|
||||
func GetLoadedWithNoSignersNotaryRepository(trust.ImageRefAndAuth, []string) (client.Repository, error) {
|
||||
func GetLoadedWithNoSignersNotaryRepository() (client.Repository, error) {
|
||||
return LoadedWithNoSignersNotaryRepository{}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user