registry tests

pull/26/head
Karolis Rusenas 2017-07-01 13:03:06 +01:00
parent dfca156961
commit ef6910c379
1 changed files with 43 additions and 0 deletions

43
registry/registry_test.go Normal file
View File

@ -0,0 +1,43 @@
package registry
import (
"github.com/rusenask/keel/constants"
"testing"
"fmt"
)
func TestDigest(t *testing.T) {
client := New()
digest, err := client.Digest(Opts{
Registry: "https://index.docker.io",
Name: "karolisr/keel",
Tag: "0.2.2",
})
if err != nil {
t.Errorf("error while getting digest: %s", err)
}
if digest != "sha256:b976145cfe8c6ed1c9670ff3309b6029e68896adee621f047e2818fafb6ee199" {
t.Errorf("unexpected digest: %s", digest)
}
}
func TestGet(t *testing.T) {
client := New()
repo, err := client.Get(Opts{
// Registry: "https://index.docker.io",
Registry: constants.DefaultDockerRegistry,
Name: "karolisr/keel",
})
if err != nil {
t.Errorf("error while getting repo: %s", err)
}
fmt.Println(repo.Name)
fmt.Println(repo.Tags)
}