You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
runner-go/registry/file_test.go

43 lines
839 B
Go

// Copyright 2019 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by the Polyform License
// that can be found in the LICENSE file.
package registry
import (
"testing"
"git.awesome-for.me/liuzhiguo/drone-go/drone"
"github.com/google/go-cmp/cmp"
)
func TestFile(t *testing.T) {
p := File("auths/testdata/config.json")
got, err := p.List(noContext, nil)
if err != nil {
t.Error(err)
return
}
want := []*drone.Registry{
{
Address: "index.docker.io",
Username: "octocat",
Password: "correct-horse-battery-staple",
},
}
if diff := cmp.Diff(got, want); diff != "" {
t.Errorf(diff)
}
}
func TestFileEmptyPath(t *testing.T) {
p := File("")
out, err := p.List(noContext, nil)
if err != nil {
t.Error(err)
}
if len(out) != 0 {
t.Errorf("Expect empty registry credentials")
}
}