Skip to content

Commit

Permalink
Rename NewConfigFile to New in configfile package
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester committed Jun 27, 2017
1 parent 62dfbef commit 379623e
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cli/command/image/pull_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestNewPullCommandErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{}, buf)
cli.SetConfigfile(configfile.NewConfigFile("filename"))
cli.SetConfigfile(configfile.New("filename"))
cmd := NewPullCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
Expand All @@ -68,7 +68,7 @@ func TestNewPullCommandSuccess(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{}, buf)
cli.SetConfigfile(configfile.NewConfigFile("filename"))
cli.SetConfigfile(configfile.New("filename"))
cmd := NewPullCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
Expand Down
4 changes: 2 additions & 2 deletions cli/command/image/push_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestNewPushCommandErrors(t *testing.T) {
for _, tc := range testCases {
buf := new(bytes.Buffer)
cli := test.NewFakeCli(&fakeClient{imagePushFunc: tc.imagePushFunc}, buf)
cli.SetConfigfile(configfile.NewConfigFile("filename"))
cli.SetConfigfile(configfile.New("filename"))
cmd := NewPushCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
Expand All @@ -74,7 +74,7 @@ func TestNewPushCommandSuccess(t *testing.T) {
return ioutil.NopCloser(strings.NewReader("")), nil
},
}, buf)
cli.SetConfigfile(configfile.NewConfigFile("filename"))
cli.SetConfigfile(configfile.New("filename"))
cmd := NewPushCommand(cli)
cmd.SetOutput(ioutil.Discard)
cmd.SetArgs(tc.args)
Expand Down
2 changes: 1 addition & 1 deletion cli/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func Load(configDir string) (*configfile.ConfigFile, error) {
}

filename := filepath.Join(configDir, ConfigFileName)
configFile := configfile.NewConfigFile(filename)
configFile := configfile.New(filename)

// Try happy path first - latest config file
if _, err := os.Stat(filename); err == nil {
Expand Down
2 changes: 1 addition & 1 deletion cli/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ func TestLoadDefaultConfigFile(t *testing.T) {

configFile := LoadDefaultConfigFile(buffer)
credStore := credentials.DetectDefaultStore("")
expected := configfile.NewConfigFile(filename)
expected := configfile.New(filename)
expected.CredentialsStore = credStore
expected.PsFormat = "format"

Expand Down
4 changes: 2 additions & 2 deletions cli/config/configfile/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ type ProxyConfig struct {
FTPProxy string `json:"ftpProxy,omitempty"`
}

// NewConfigFile initializes an empty configuration file for the given filename 'fn'
func NewConfigFile(fn string) *ConfigFile {
// New initializes an empty configuration file for the given filename 'fn'
func New(fn string) *ConfigFile {
return &ConfigFile{
AuthConfigs: make(map[string]types.AuthConfig),
HTTPHeaders: make(map[string]string),
Expand Down
4 changes: 2 additions & 2 deletions cli/config/configfile/file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ func TestProxyConfigPerHost(t *testing.T) {

func TestConfigFile(t *testing.T) {
configFilename := "configFilename"
configFile := NewConfigFile(configFilename)
configFile := New(configFilename)

assert.Equal(t, configFilename, configFile.Filename)
}

func TestGetAllCredentials(t *testing.T) {
configFile := NewConfigFile("filename")
configFile := New("filename")
exampleAuth := types.AuthConfig{
Username: "user",
Password: "pass",
Expand Down

0 comments on commit 379623e

Please sign in to comment.